A research workspace and simulation project for Theseus, Claude Shannon’s 1950 relay-based maze-solving mouse — later nicknamed “Mighty Mouse.”
theseus-sm)The crate at the repo root is a deterministic, no_std, dependency-free state
machine for the 5x5 maze. It has two surfaces:
Theseus::autopilot_step / run_autopilot — the historical explore/goal
strategy.Theseus::apply(Action) — an explicit action surface for RL and learned-policy
evaluation.use theseus_sm::{Action, Cell, Direction, Maze, Theseus};
let maze = Maze::from_ascii(include_str!(
"vendor/TheseusSimProcessing/Theseus/video1.maze"
))?;
let start = Cell::new(0, 0).unwrap();
let goal = Cell::new(4, 4).unwrap();
let mut machine = Theseus::new(maze, start, goal);
machine.run_autopilot(100_000); // explore until the goal
machine.start_goal_run(start); // run again from memory
machine.run_autopilot(10_000);
// Action-driven surface:
let result = machine.apply(Action::Move(Direction::East));
let mut obs = [0.0f32; theseus_sm::N_OBS];
let mut mask = [0.0f32; theseus_sm::N_ACTIONS];
machine.write_observation(&mut obs);
machine.write_action_mask(&mut mask);
cargo test
cargo run --example demo # five historical layouts, explore + learned run
cargo run --example sweep # random solvable mazes from blank memory
Defaults follow the reference implementations: memory starts East, turn is
clockwise, a wall contact rotates the stored direction, goal mode abandons after
24 cell entries, and exploration skips the entrance direction once per cell
entry. with_turn switches to counterclockwise.
Known limitation: after a learned route is walled off, the deterministic
exploration strategy can enter a stable cycle for some wall configurations. All
five historical layouts and 700+ random solvable mazes from blank memory are
validated, but conditioned relearning is not guaranteed by this implementation.
See docs/corpus-notes.md for the reference-code lineage.
web/ is a static SPA over crates/theseus-wasm. It fills the viewport: a
compact top bar, the board as the main surface, and a tabbed inspector for the
relay memory and cutaway. The rules stay in Rust; the JavaScript only draws
state and forwards clicks.
./scripts/build-wasm.sh # rebuild web/pkg (wasm-bindgen 0.2.129)
./scripts/serve.sh # http://localhost:8765
The default view is X-ray. Click a cell to place the mouse, click a wall to move the partition, right-click a cell to place the goal. Click a relay-memory cell to cycle its remembered direction (right-click to cycle back). The policy selector switches between the historical autopilot and a deterministic random baseline.
GitHub Pages branch sources only support / or /docs, so this repo publishes
web/ with .github/workflows/pages.yml instead. In Settings → Pages, set
Source to GitHub Actions. The workflow uploads web/ on every push to
main; web/CNAME keeps the custom domain theseus.livive.net.
DNS should be:
theseus.livive.net CNAME jpeckenpaugh.github.io
cargo run --example compare
Prints historical exploration, the learned goal run, and the average random baseline over 32 seeds for each historical layout.
lib.rs theseus-sm core (no_std, zero dependencies)
crates/theseus-wasm/ wasm-bindgen wrapper over the core
web/ static browser demo and committed wasm/pkg build
scripts/ build-wasm.sh, serve.sh
tests/ engine, historical-layout, and proptest suites
examples/ demo, compare, random-maze sweep
docs/
apparatus.md Under-table mechanism and component arrangement
references.md Survey of codebases, demos, replicas, primary sources
corpus-notes.md Architecture notes across the GitHub corpus
sources/ Mirrored papers, film, articles, and scans
SOURCES.md Provenance, original URLs, checksums
vendor/
TheseusSimProcessing/ Processing/Java 2D simulator (raigl) — best algorithm base
TheseusSoftware/ HNF museum replica firmware (raigl) — behavioral reference
mines-sm/ Single-file no_std Rust state machine — closest code template
cc-livive-net/ Rust no_std state-machine + WASM reference architecture
git submodule update --init --recursive
| Path | Upstream |
|---|---|
vendor/TheseusSimProcessing |
https://github.com/raigl/TheseusSimProcessing |
vendor/TheseusSoftware |
https://github.com/raigl/TheseusSoftware |
vendor/mines-sm |
git@github.com:jpeckenpaugh/mines-sm.git |
vendor/cc-livive-net |
git@github.com:jpeckenpaugh/cc-livive-net.git |
vendor/mines-sm (crate mine-sm) is the closest template for our core: a
388-line, dependency-free #![no_std] state machine with a u64 bitboard,
[f32; 64] observation/action-mask ABI, deterministic SplitMix64, and golden /
exhaustive test fixtures.
vendor/cc-livive-net is an unrelated project (a deterministic 3x3 cube state
machine) included as an architectural reference for scaling the same pattern to
a Cargo workspace with a WASM front end. See docs/corpus-notes.md.
Explore rotates from memory on entry and skips the entrance on
its first rotation; Goal follows memory directly and falls back after 24
entries.Theseus::write_observation’s
doc comment for exact offsets. (cargo doc --open.)write_open_mask excludes walls.state_key() packs the policy-relevant state into a u128.Policy::next_action and call run_policy, or use
the built-in RandomPolicy; RunSummary reports steps, moves, bumps, and
timeouts.Next steps: add a WASM wrapper and a renderer, then use apply(Action) to
evaluate learned policies against the historical autopilot.
See docs/references.md for the source survey and
docs/corpus-notes.md for the Rust/WASM architecture lineage.