ferravex
GitHub

Tin Automata

A robot-programming puzzle campaign about bringing the Daybreak factory back to life. Write a short instruction tape, watch your tin courier obey it, and repair the program when its route goes wrong. Deliver every numbered parcel to its matching dock to restore a workbench; finish all twelve to revive the factory.

The campaign contains twelve distinct authored 9-by-7 workbenches, seventeen parcels, seven instructions, two switch circuits, and thirty-six available stars. Its mint, copper and cream workshop art is drawn procedurally. The screen explains itself with pictures rather than sentences: instructions are icon tiles, the program is a strip of icon cells, and parcel numbers, gate letters, the robot's facing arrow, the tape cursor and the glowing execution head make the rules visible without relying only on color.

Start playing

From the repository root:

cargo run -p tin-automata --offline --locked

Read the title screen's field guide with H, then start. In the first room, write Forward, Grab, Forward, Forward, Forward, Forward, Drop. Choose each instruction with Left/Right and press Space to write it, or click its tile, then press 1 (or the play button) to run. The robot starts facing east. A room ends immediately after its last delivery; Space or the Next button then opens the next workbench with an empty tape.

Controls

ControlAction
Left/Right or A/DChoose an instruction while editing
Up/Down or W/SMove the tape editing cursor
Space or EnterWrite/replace the selected instruction and advance; after a fault return to editing; after a clear enter the next room
X or EDelete the selected instruction; at the append cell delete the last instruction
1Run from the restored board; during execution pause/resume
2Start with one step, or perform one execution step and pause
C or QStop and restore this workbench, retaining the program
3Undo a tape edit, including deletion or clear; up to 32 edits
4Clear the tape while editing; undo can recover it
5Open/close the current room's hint; opening it pauses execution
Click a tape cellSelect that cell while editing
Click an instruction tileChoose it and write it at the cursor, exactly like choosing it and pressing Space
Click a button under the tapeRun/pause (1), step (2), stop (C), undo (3), clear (4) or hint (5)
Click Next on a solved cardOpen the next workbench, like Space
HShared field guide
P or EscapeShared campaign pause
RRestart the entire campaign, including earned stars and current tape
MToggle shared audio

Closing a hint does not resume execution automatically; press 1 to resume. Editing commands are ignored while the robot runs or is paused. Use C to restore the board before editing. Holding a direction does not repeatedly change the tape: the editor consumes key presses.

Reading the screen

Instructions and factory rules

InstructionEffect
ForwardMove one tile in the robot's current facing direction
LeftTurn ninety degrees left without changing position
RightTurn ninety degrees right without changing position
GrabPick up a parcel on the robot's current tile; capacity is one
DropPlace the carried parcel on the current tile
Repeat 2Execute the most recent simple instruction two additional times; unlocked in room 5
Repeat 3Execute the most recent simple instruction three additional times; unlocked in room 6

Forward followed by Repeat 3 moves four tiles in total. A repeat instruction needs an earlier simple instruction. Consecutive repeats use that same simple instruction rather than recursively expanding each other. The repeat command itself and each expanded copy are separate visible execution steps; automatic execution performs one step every 18 fixed ticks, or 0.3 seconds at 60 Hz.

The robot can carry a parcel across other parcels. It can set one down on empty floor and pick it up again later. A numbered dock permanently accepts only its matching parcel. Dropping on the wrong dock, dropping onto another parcel, grabbing with full arms, or using empty arms incorrectly causes a fault without destroying parcels. Walls, pits and closed gates also stop an attempted move.

Walking onto switch a latches gate A open for this attempt; b opens B. The switch stays active after the robot leaves. A stop or retry restores the robot, parcels, deliveries and both switches together while preserving the edited tape. A fault freezes execution and records one failed attempt; press C or Space to edit and try again. There is no campaign game-over limit.

5 opens the hint: the room's reference route appears on the board as gold chevrons marching from the start to the final dock, and the room is capped at two stars. The written route advice is published to status readers while the hint is open.

Each room restricts the number of occupied tape cells. The editor cannot exceed that budget, and no tape can exceed 32 instructions. An attempt also stops at 160 execution steps, so an invalid program cannot run indefinitely. Undo affects the tape, not accumulated hint or fault penalties.

Campaign and medals

RoomWorkbenchNew challengeTape limitThree-star par
1First ParcelPick up and deliver107
2The Right AngleA corridor with a right turn129
3Upstairs MailLeft turns and northbound delivery129
4The Missing FloorRoute around a broken floor1614
5Repeat DepartmentCompress a straight route with Repeat 287
6Long DeliveryCombine Repeat 3 with a corner119
7Wake the SwitchOpen a gate along the delivery route86
8SwitchbackDetour to a remote switch1815
9Two AddressesDeliver two numbered parcels in one tape2117
10Twin RelaysActivate two circuits in sequence1210
11Assembly LineThree deliveries and two return journeys3229
12The Daybreak EngineThree unequal delivery routes and linked gates3229

Three stars require a program at or below par, no faults, and no hint use. Two stars allow at most four extra instructions and two faults. Other successful programs earn one star. Viewing a hint caps that room at two stars, even after undoing or clearing the tape. Stopping an experiment before it faults is free.

Each completed room banks 500 + 500 * stars + max(100 - executed_steps, 0) points once. Editing, failed actions and replaying a solved screen cannot farm score. The final card shows restored workbenches (gear), stars, perfect rooms (crown), each room's medal and the total points. The shared host can retain completed-run records locally when available; an unfinished campaign, tape, and individual level selections are not saved.

Planning a good program

Trace the robot's facing through each corner before adding movement commands. Count travel after the parcel tile, not from the starting tile. Step through the first turn or switch to verify it, then stop, edit and rerun from the restored board. Repeats are most useful after Forward, but repeating a turn can express a return journey too. With several parcels, finish one delivery before returning for the next, and remember that return turns reverse which way Left points.

The displayed par is a tested reference-program length, not a claim of a proven global minimum. Shorter legal solutions are welcome. Replaying the full campaign can improve stars and the execution-step bonus.

Implementation and validation

model.rs contains the pure fixed-tick rules and bounded state, content.rs contains the authored rooms, layout.rs holds the geometry shared by drawing and pointer hit-testing, and view.rs contains read-only rendering and effects. The model also keeps presentation-only memory that its rules never read: the events accepted by the latest update, the robot's previous pose for gliding, the attempt's trail and its fault. Position cells reuse ferravex_play::navigation::Cell. No external dependencies or assets are added. The shared arcade host owns timing, input edge retention, menus, letterboxing, audio cues and completed-run records.

The public API exports Game, Phase, META, and the generated run() entry. Game::new, step(&Input), outcome, room, phase, program_len, executed_steps, score, summary, and the read-only pilot(tick) support headless callers. The model module includes an executable rustdoc example.

cargo test -p tin-automata --offline --locked -j 2
cargo clippy -p tin-automata --all-targets --offline --locked -j 2 -- -D warnings
cargo run -p tin-automata --offline --locked -- --headless
rustfmt --edition 2024 --check examples/tin-automata/src/*.rs

Twenty-six behavioral tests cover editing and undo, hard budgets, repeat expansion, turning, execution cadence, pause/step/stop, fault atomicity, parcel handling, switch reset, hazards, hints and medals, pointer controls that mirror keys, the shared drawing/hit-test geometry, presentation events and effects, header progress and copy, the short guide, full campaign wins, and exact replay. The complete-campaign tests begin with Game::new() and enter every solution through ordinary editor inputs; they never inject tapes, room progress or victory state. Focused rule tests set up individual edge cases. The headless pilot likewise enters its reference programs through the same player controls. It completes all twelve rooms at tick 8988 with 36 stars and 24,974 points. This is simulation validation, not a human balance playtest.

The parent integration review inspected an actual native gameplay capture. Browser/Wasm integration is parent-owned. This package does not independently claim browser, mobile, cross-platform or audio-output validation. There is no level editor, cloud save, multiplayer, condition instruction or nested loop; the bounded repeat instructions provide the campaign's control-flow mechanic.