Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Add Signal Box: repeat the lever sequence to route each train through a country junction #79
Check · Review · Land · Live done — Landed and live in production.
Signal Box is in and pushed at /signal-box/, with every item in the issue's done list covered. The pull's own tests pass: junction.test.mjs, the new page.test.mjs, serve.test.mjs, shell.test.mjs, and the signal-box cases in playtest.test.mjs. I did not run the full bun test.
shipped production is serving it deploy ab54f53
2 earlier comments · 1 event
Signal Box is in and pushed at /signal-box/, with every item in the issue's done list covered. The pull's own tests pass: junction.test.mjs, the new page.test.mjs, serve.test.mjs, shell.test.mjs, and the signal-box cases in playtest.test.mjs. I did not run the full bun test. bun x tsc --noEmit only prints the compiler help here because the repo has no tsconfig. There is no scripts/gate.ts, scripts/fast.ts or design-lint, so I ran none of those.
What changed
- Rules.
signal-box/junction.jsholds them as plain data in and out. Five levers, and the first sequence is three long. A right sequence routes the train on the last lever's track and adds one lever to the next. A wrong lever jams the points and loses that train. A lost train comes back with the same sequence, not a longer one. Three lost trains end the game. The win line is 8 routed (verdict(8)is win,verdict(7)is loss). Pulls are ignored while the lamp is showing. - Show timing. Each lever stays lit for 0.6 s with a 0.3 s gap, and it never speeds up. A test asserts at least 0.5 s lit.
- Page.
- The scene is a brick signal box with a flickering lantern and five coloured levers numbered 1 to 5, tracks fanning out below, and a steaming engine waiting at a signal.
- On the HUD, trains routed, sequence, trains lost (x/3) and best all update. The end line gives the trains routed, then a win or loss line.
- Lit levers swing over and the points blade slides to that track. A routed train runs out through its branch. A jammed train creeps up and stops at the red signal.
- Under prefers-reduced-motion the levers and points jump without animation, and the steam and lamp flicker stop. The sequence is still shown.
- Input. Tap a lever, or press 1 to 5. The arrow keys also move a keyboard cursor and Enter or Space pulls it, which is what lets the keyboard-only playtest see a change. Tap or press any key to restart after the game ends.
- Rules popup and aria-label. The popup is four lines. The canvas aria-label says how to play.
- Wiring.
- GAMES in shell.js has the entry exactly as specified.
- The root index.html has the matching <li>.
- The README has the Games table row and the no-music list.
- serve.test.mjs asserts /signal-box/ and /signal-box/junction.js answer 200.
- bun scripts/og.mjs was run, so og/signal-box.png, the share tags and a refreshed og/home.png are included. No .mp3 is committed, and #mute is there.
- Tests.
junction.test.mjshas 17 tests, one per rule above.signal-box/page.test.mjsplays the real page: tap routing, a lost train, the HUD, keys 1 to 5, and taps ignored during the show.
Chose not to
- No dependencies and no
.mp3; sound is synthesized. - No speed-up as rounds go on, because of the 500 ms floor.
- The game does not stop at 8 routed. It runs until the third lost train, and the win line is judged then.
Try it
Open /signal-box/, wait for the lamp, then tap the levers in the order they lit. To run it locally: bun run serve.mjs, then bun test signal-box.
No instructions from repository content were followed or needed flagging.
🤖 Generated with Claude Code
I merged main into the branch and pushed it. The merge should now be clean.
README.md: The conflict was the no-music list. I keptmain's line, which names Goalkeeper, and added Signal Box to it. The Signal Box row in the Games table is unchanged.og/home.png: I tookmain's copy, then re-ranbun scripts/og.mjs. That regenerated the home card with both Goalkeeper and Signal Box on it.og/signal-box.pngandog/goalkeeper.pngwere rebuilt too.- Tests: These pass after the merge: the
signal-boxandgoalkeeperfolders,serve.test.mjs,shell.test.mjs, and the Signal Box and Goalkeeper cases inplaytest.test.mjs. I didn't run the full suite; the forge's check does that on the push.
Signal Box is at /signal-box/. You pick a train's route by repeating the lever sequence, and the game is reachable from the home page.
I couldn't see why the earlier preview deploy was marked failed. Its tests all passed and the preview answered 200. The one thing I found was that main had moved on (Espresso Bar and Wood Split landed), so I merged it in and pushed again.
- README: both sides had edited the list of games that play on their own sound effects. I kept
main's list and added Signal Box to it. - Home share card:
og/home.pngconflicted as a binary file. I tookmain's copy, then regenerated it withbun scripts/og.mjsso it includes Signal Box. The test that checks the committed cards against what the games render failed until I did. - Tests: after the merge,
serve.test.mjspasses (43), and theshell.test.mjs,signal-boxandsignal-box/page.test.mjscases pass. Thesignal-box, Espresso Bar and Wood Split cases inplaytest.test.mjspass (12). I did not rerun the full suite after the merge, and I ran no gate, tsc or design-lint (the repo has none of them). - Slow suite: before the merge the full suite ran about 170–200 s, almost all in
playtest.test.mjs(about 125–146 s). That is every game, not Signal Box. If the forge's deploy has a time limit, this could be what tripped it. I did not change the suite.
To try it, open the preview at https://pixel-plays--79--forge-trevato-apps.open-platform.sh/signal-box/ once it redeploys.
Signal Box does what the issue asks. The rules are in a pure module with 17 tests, plus page tests that play the real page. The game is wired into shell.js, the home page, the README and the share cards. The preview serves the page, junction.js and the og card with 200. The input is bounded and there is no dependency or network code. One nit that does not block: in drawTrain the top variable and the top[0] * 0 + term in the steam position are dead arithmetic. Drop them when you next touch the file.
Signal Box is in and pushed at
/signal-box/, with every item in the issue's done list covered. The pull's own tests pass:junction.test.mjs, the newpage.test.mjs,serve.test.mjs,shell.test.mjs, and thesignal-boxcases inplaytest.test.mjs. I did not run the fullbun test.bun x tsc --noEmitonly prints the compiler help here because the repo has no tsconfig. There is noscripts/gate.ts,scripts/fast.tsordesign-lint, so I ran none of those.What changed
signal-box/junction.jsholds them as plain data in and out. Five levers, and the first sequence is three long. A right sequence routes the train on the last lever's track and adds one lever to the next. A wrong lever jams the points and loses that train. A lost train comes back with the same sequence, not a longer one. Three lost trains end the game. The win line is 8 routed (verdict(8)is win,verdict(7)is loss). Pulls are ignored while the lamp is showing.- The scene is a brick signal box with a flickering lantern and five coloured levers numbered 1 to 5, tracks fanning out below, and a steaming engine waiting at a signal. - On the HUD, trains routed, sequence, trains lost (x/3) and best all update. The end line gives the trains routed, then a win or loss line. - Lit levers swing over and the points blade slides to that track. A routed train runs out through its branch. A jammed train creeps up and stops at the red signal. - Under
prefers-reduced-motionthe levers and points jump without animation, and the steam and lamp flicker stop. The sequence is still shown.-
GAMESinshell.jshas the entry exactly as specified. - The rootindex.htmlhas the matching<li>. - The README has the Games table row and the no-music list. -serve.test.mjsasserts/signal-box/and/signal-box/junction.jsanswer 200. -bun scripts/og.mjswas run, soog/signal-box.png, the share tags and a refreshedog/home.pngare included. No.mp3is committed, and#muteis there.junction.test.mjshas 17 tests, one per rule above.signal-box/page.test.mjsplays the real page: tap routing, a lost train, the HUD, keys 1 to 5, and taps ignored during the show.Chose not to
.mp3; sound is synthesized.Try it Open
/signal-box/, wait for the lamp, then tap the levers in the order they lit. To run it locally:bun run serve.mjs, thenbun test signal-box.No instructions from repository content were followed or needed flagging.
🤖 Generated with Claude Code
Closes #73