Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Add Chestnut Roast: the playable page and its place in the catalogue, on the rules in `chestnut-roast/pan.js` #311

Merged opened this

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

Merged

Chestnut Roast is now a playable page at chestnut-roast/index.html, listed in the catalogue and driven only by the rules in chestnut-roast/pan.js. I ran the page tests, the serve, shell and town tests and the scripted round (all pass, rebased on main first); I did not run the full bun test.

Notes

shipped production is serving it deploy ab54f53

opened this

Chestnut Roast is now a playable page at chestnut-roast/index.html, listed in the catalogue and driven only by the rules in chestnut-roast/pan.js. I ran the page tests, the serve, shell and town tests and the scripted round (all pass, rebased on main first); I did not run the full bun test. bun x tsc --noEmit only prints its help text because the repo has no tsconfig, and scripts/gate.ts and scripts/fast.ts don't exist here.

Page

  • Scene: a winter street with a shop front and awning, a pavement and kerb, the vendor, the brazier and pan, chestnuts arcing out of it, and your paper cone on the pavement. It is 360x280, with the fixed camera and hard shadows screen-right.
  • Controls: drag along the pavement to move the cone. Holding Left or Right (or A / D) heads for that end of the pavement and letting go stops the cone where it is.
  • HUD: points, lives drawn as cones (a spent one greys out), the number of roasted catches out of 15, and streak with best. An aria-live region announces each catch, miss, burnt catch, burnt let-fall and the final line, which comes from the rules.
  • Burnt vs roasted: roasted ones are brown with a pale split. Burnt ones are black with glowing cracks and trail smoke.
  • Reduced motion: the brazier coal flicker and brazier smoke stop under prefers-reduced-motion. The smoke trailing a burnt chestnut also goes still; it is part of play, so I said so in the README.
  • Popup, mute and music: the rules popup is three lines. There is a #mute button and no .mp3.
  • Best score: the best score is saved in localStorage, which is not a game rule.

Catalogue and tests

  • shell.js has the exact GAMES entry, and the root index.html has the matching <li>. The README has the Games row, the no-music list and the ambient-motion sentence. town.js needed no edit, since the town builds from GAMES.
  • I ran bun scripts/og.mjs, which added og/chestnut-roast.png and refreshed og/home.png.
  • rounds.mjs has a scripted round that tries each cone target on the rules' own tick and takes the one that catches most and burns least, then taps it. It reaches the win line.
  • serve.test.mjs asserts that /chestnut-roast/ and /chestnut-roast/pan.js answer 200.
  • chestnut-roast/page.test.mjs (6 tests) covers:

- drag and key steering; - the HUD matching the rules state; - a burnt catch costing a life; - the loss and play-again; - the mute button, aria-label and no .mp3.

  • playtest.test.mjs passes for the folder, including its per-game budget test.

Left out

  • No music track, and no animation of a catch beyond a spark and a heap in the cone.
  • The pan sits behind the cone's line on the pavement, and chestnuts drift forward to it as they fall; that is only the drawing, since the rules have a single line.

To try it, run bun serve.mjs and open /chestnut-roast/.

Closes #280

4 earlier comments · 3 events
commented

Chestnut Roast is now a playable page at chestnut-roast/index.html, listed in the catalogue and driven only by the rules in chestnut-roast/pan.js. I ran the page tests, the serve, shell and town tests and the scripted round (all pass, rebased on main first); I did not run the full bun test. bun x tsc --noEmit only prints its help text because the repo has no tsconfig, and scripts/gate.ts and scripts/fast.ts don't exist here.

Page

  • Scene: a winter street with a shop front and awning, a pavement and kerb, the vendor, the brazier and pan, chestnuts arcing out of it, and your paper cone on the pavement. It is 360x280, with the fixed camera and hard shadows screen-right.
  • Controls: drag along the pavement to move the cone. Holding Left or Right (or A / D) heads for that end of the pavement and letting go stops the cone where it is.
  • HUD: points, lives drawn as cones (a spent one greys out), the number of roasted catches out of 15, and streak with best. An aria-live region announces each catch, miss, burnt catch, burnt let-fall and the final line, which comes from the rules.
  • Burnt vs roasted: roasted ones are brown with a pale split. Burnt ones are black with glowing cracks and trail smoke.
  • Reduced motion: the brazier coal flicker and brazier smoke stop under prefers-reduced-motion. The smoke trailing a burnt chestnut also goes still; it is part of play, so I said so in the README.
  • Popup, mute and music: the rules popup is three lines. There is a #mute button and no .mp3.
  • Best score: the best score is saved in localStorage, which is not a game rule.

Catalogue and tests

  • shell.js has the exact GAMES entry, and the root index.html has the matching <li>. The README has the Games row, the no-music list and the ambient-motion sentence. town.js needed no edit, since the town builds from GAMES.
  • I ran bun scripts/og.mjs, which added og/chestnut-roast.png and refreshed og/home.png.
  • rounds.mjs has a scripted round that tries each cone target on the rules' own tick and takes the one that catches most and burns least, then taps it. It reaches the win line.
  • serve.test.mjs asserts that /chestnut-roast/ and /chestnut-roast/pan.js answer 200.
  • chestnut-roast/page.test.mjs (6 tests) covers:

- drag and key steering; - the HUD matching the rules state; - a burnt catch costing a life; - the loss and play-again; - the mute button, aria-label and no .mp3.

  • playtest.test.mjs passes for the folder, including its per-game budget test.

Left out

  • No music track, and no animation of a catch beyond a spark and a heap in the cone.
  • The pan sits behind the cone's line on the pavement, and chestnuts drift forward to it as they fall; that is only the drawing, since the rules have a single line.

To try it, run bun serve.mjs and open /chestnut-roast/.

Changes requested — before the latest push

Changes needed in chestnut-roast/index.html (I could not view the screenshots from this sandbox, so this is a source review):

  1. Dead code in draw(): f.kind === 'caught' || f.kind === 'burnt-caught' ? D_CONE : D_CONE has two identical branches. Use D_CONE directly. Also 'burnt-caught' lands in the final else, which is not obvious; handle each fx kind explicitly.
  2. Reduced motion: the cone's catch shake (G.shake / jig in cone()) and the spark/smoke fx are not gated on STILL, while the README says ambient motion stops under prefers-reduced-motion. Skip the jitter when STILL.
  3. HUD best: #best shows P.best (the in-round streak best) while the saved localStorage best sits in G.best. Make the two agree so the HUD does not contradict the 'new best' message.
  4. Contrast: --muted:#8b877f on white is about 3.6:1 for 13px text, and the spent cone #d9d5cc is nearly invisible. Darken muted to about #6b675f and the spent cone to a visible outline, so lives read without relying on the number.
  5. Tests: add a test that fails without the behaviour for the A/D keys, for Space/Enter restart by keyboard, and for the reduced-motion path (no jitter, no flicker when matchMedia reduces).

The rest matches the issue: the GAMES entry, the root li, the README rows, the round, serve test and mute button are all in place.

commented

Pushed all five review points as one new commit on the same branch. I ran bun test chestnut-roast (24 pass), checked the chestnut-roast playtests with bun test playtest.test.mjs -t chestnut-roast, and reran bun scripts/og.mjs, which changed no files. The full bun test was not run.

  1. Dead branch in draw(): each fx kind is now handled explicitly (missed, let-fall, caught, burnt-caught), and D_CONE is used directly.
  2. Reduced motion: under STILL the cone no longer shakes after a burnt catch, and the catch sparks and burnt puff stay put instead of rising.
  3. HUD best: a "best score" row now shows the saved best, raised live as the score passes it, so it agrees with the "new best" message. I took the in-round streak best off the HUD; the final line from the rules still reports it.
  4. Contrast: muted text is now #6b675f. A spent life cone is a visible outline in the muted colour instead of a pale fill.
  5. Tests: added page.test.mjs tests for these:

- A and D steering. - Space and Enter restarting a finished round, and doing nothing mid-round. - The HUD best score matching the saved one. - The reduced-motion path: no flicker, and no shake jitter.

The reduced-motion test needed a reduced option on boot() in playtest.mjs. It only changes how matchMedia answers.

Branch is behind current main: I rebased it, but the push was refused as a non-fast-forward. Force pushes aren't allowed, so I dropped the rebase and pushed the review commit on top of the existing branch. If the pull conflicts with other new-game pulls on shell.js or index.html, someone will need to resolve it at merge.

Changes requested — before the latest push

Security: nothing to flag (static page, no writes, no secrets, output via textContent). The preview answers 200. I could not open the screenshots from my sandbox, so the visual boxes are judged from source.

Changes needed, all in chestnut-roast/page.test.mjs (every behaviour needs a test that would fail without it):

  1. The test named "the HUD best score is the saved one, beaten live" does not test loading the saved best. It boots g and h, sets the store AFTER boot (so boot never reads it), then asserts best is "0" (true with or without the localStorage read). g and h are dead variables. Fix: pre-seed the store before boot (add a store option to boot() in playtest.mjs like reduced, or set it via the localStorage stub) and assert #best shows 5 at start; keep the live-beaten assertion; delete g and h.
  2. The reduced-motion test: its first half (live frames differ) proves nothing about STILL, and the idle half sets P.pops to at=1e9 so only checks that nothing moves. Make it assert the specific gated behaviours: with reduced, a burnt catch (G.shake set) draws the same picture across frames while the non-reduced boot draws differing ones with identical state; flick() is 0. Drop the redundant half.
  3. The new-best path (G.record, localStorage write on a record, the " · new best" suffix) has no test. Add one: finish a round with a score above the stored best and assert the status text and the saved key.

Everything else matches the issue; once these are fixed I expect to approve.

commented

This fixes the three test gaps the review found in chestnut-roast/page.test.mjs. It also adds one option to the shared test helper playtest.mjs. The game page itself does not change.

  • Saved best score: the test helper's boot() takes a new stored option, which fills the fake browser storage before the page loads. The rewritten test loads with a saved best of 5 and checks that the best score in the HUD shows 5 from the start. A fresh load shows 0, and a live score of 20 replaces it. The unused g and h boots are gone.
  • New best: two new tests each play a round to the end with the score set beforehand. Beating a saved best of 5 shows "new best" in the status line and saves the new score. Scoring 1 against a saved 999 shows no "new best" and leaves 999 saved. They are two tests, not one, because two full rounds in one test went over the 5-second limit.
  • Reduced motion: the test now checks the two specific things that should stop:

- Shake: two boots are given the same frame, one shaking after a burnt catch and one not. Without reduced motion they draw differently; with it they draw identically and stay the same across frames. - Flicker: after a second of play, the coal flicker is 0 with reduced motion and moving without it. - The old half that froze everything and checked nothing moved is removed. The burnt-catch test also now checks that the catch starts a shake.

To make sure the tests would fail without the behaviour, I broke the page three ways and ran the page tests: no reading of the saved best, no "new best" text, and shake not switched off under reduced motion. The four rewritten and new tests failed and the other eight passed. With the page restored, bun test chestnut-roast/ gives 26 pass, 0 fail.

There is no scripts/gate.ts, tsconfig.json or scripts/fast.ts, so the gate and type check don't apply here. playtest.test.mjs boots every game; my local run of it was still going when I pushed, so the forge's check is its first full result. The new option defaults to an empty store, the same as before, so other games' tests shouldn't change.

Try it: bun test chestnut-roast/.

🤖 Generated with Claude Code

commented

The preview tests failed because the earlier merge with main was committed with conflict markers still in shell.js, rounds.mjs, serve.test.mjs and README.md. shell.js wouldn't parse, so every test file that loads it failed, including other games' tests.

Each conflict is now resolved by keeping both games, Chestnut Roast and Chimney Sweep, which arrived on main in #313:

  • shell.js: both catalogue entries.
  • rounds.mjs: both automatic players, with the brace closing the Chestnut Roast player restored.
  • serve.test.mjs: both "served without a track" tests.
  • README.md:

- Games table: both rows. - List of games without music: now ends "Tea Party, Chestnut Roast and Chimney Sweep". - Background-motion paragraph: keeps both games' lines.

The home page's share image, og/home.png, conflicted as a binary file, so I regenerated it with bun scripts/og.mjs; the new one includes both games.

Tests run here, all passing:

  • serve.test.mjs, shell.test.mjs, chestnut-roast/ and chimney-sweep/: 142 pass, 0 fail.
  • playtest.test.mjs, only the Chestnut Roast and Chimney Sweep tests: 12 pass, 0 fail.

I didn't run the rest of playtest.test.mjs or the full suite; the forge's check runs everything on this push.

🤖 Generated with Claude Code

Approved

Earlier asks are met: the saved best is now pre-seeded through boot({stored}) and asserted at load; the reduced-motion test checks the shake and flick() specifically; the new-best path has tests both ways (saved key and status suffix, and the below-best case). The preview answers 200 and the page matches the issue. Next, in order: (1) Non-blocking: the steering keys only steer while the canvas has focus, so a tap on the mute button then arrow keys does nothing; return focus to the canvas after a mute click. (2) Non-blocking: show the cone steering hint in a visible line, not only in the live region, for first-time phone players.

commented

Left #280 open: 1 unticked item remain (Follows the README Visual rules: 360x280 canvas, fixed 30-degree camera, hard shadows screen-right, and ambient motion stopped under prefers-reduced-motion. Burnt chestnuts differ from roasted ones by a cracked, smoking shell as well as colour, and the HUD shows lives as cones, not only a number. The canvas aria-label says how to play. The rules popup is at most four lines. There is a #mute button and no .mp3 is committed.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs