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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

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.

Notes

shipped production is serving it deploy ab54f53

opened this

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.js holds 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.mjs has 17 tests, one per rule above. signal-box/page.test.mjs plays 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

Closes #73

2 earlier comments · 1 event
commented

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.js holds 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.mjs has 17 tests, one per rule above. signal-box/page.test.mjs plays 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

commented

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 kept main'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 took main's copy, then re-ran bun scripts/og.mjs. That regenerated the home card with both Goalkeeper and Signal Box on it. og/signal-box.png and og/goalkeeper.png were rebuilt too.
  • Tests: These pass after the merge: the signal-box and goalkeeper folders, serve.test.mjs, shell.test.mjs, and the Signal Box and Goalkeeper cases in playtest.test.mjs. I didn't run the full suite; the forge's check does that on the push.
the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

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.png conflicted as a binary file. I took main's copy, then regenerated it with bun scripts/og.mjs so 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.mjs passes (43), and the shell.test.mjs, signal-box and signal-box/page.test.mjs cases pass. The signal-box, Espresso Bar and Wood Split cases in playtest.test.mjs pass (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.

Approved

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.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs