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

opened this

Merged 29d 16h ago, live in production

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

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
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/.

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.

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

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.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs