Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Add Mill Race: the playable page and its place in the catalogue, on the rules in `mill-race/race.js`, inside the per-game test budget #252
Check · Review · Land · Live done — Landed and live in production.
Mill Race is now playable at /mill-race/, built on race.js, and it's listed in the catalogue. The Mill Race tests, serve.test.mjs and shell.test.mjs pass. I did not run the full bun test, so the forge's check will be the first full run.
shipped production is serving it deploy ab54f53
4 earlier comments · 3 events
Mill Race is now playable at /mill-race/, built on race.js, and it's listed in the catalogue. The Mill Race tests, serve.test.mjs and shell.test.mjs pass. I did not run the full bun test, so the forge's check will be the first full run. The branch is rebased on main, which brought in Patchwork Quilt (#245).
What the page does
- Drawing: it draws the stone tiles, the water in the cells
flowreports, a sluice on the west side and the wheel on the east. All rules come fromrace.js. - Play: tap a tile to turn it. Arrows move a yellow cursor and Space or Enter turns the tile. The HUD shows level, moves and par.
- Announcements: the aria-live region announces each move and each cursor step, for example "Column 3, row 2: bend opening north, east".
- Water and wheel: wet channels are wide and blue with glints, and dry ones are narrow dark grooves. Solid stone blocks refuse the turn and say why. The wheel spins only while the rules put water at it.
- Cache: the tile layer is drawn once per change (turn, cursor, level) and cached. Per frame only the glints and the wheel are drawn. A test checks the redraw count.
- Mute and popup: there is a
#mutebutton with a 44px target, no.mp3, and a four-line rules popup. - Catalogue: it has its
GAMESentry exactly as specified, the root<li>, and the README Games row, no-music list and motion note.bun scripts/og.mjshas been run. - Tests:
rounds.mjshas a scripted round that clears all 5 levels at par, andserve.test.mjschecks/mill-race/and/mill-race/race.jsreturn 200.mill-race/page.test.mjsis new. - Budget: the six Mill Race playtests together take about 3 s here, well inside the 15 s per-game budget.
Choices
reachesexport: I addedreachesto the exports ofrace.js, with a test, so the page can ask the rules whether water reaches the wheel instead of re-deriving it.- Cleared level on show:
turnlays the next level immediately. To show the wheel turning, the page keeps the cleared level on screen for 1 s with the final tile turned. That turn is a copy of the old state, not a rule. - Reduced motion: the wheel doesn't spin under
prefers-reduced-motion. It holds still and its paddles turn blue instead. The README says so.
Not done
scripts/gate.ts,scripts/design-lint.tsand a tsc config don't exist in this clone, so none of those ran.- I did not run the full
bun test.
To try it
Run bun run serve.mjs and open /mill-race/.
The preview serves /mill-race/ and /mill-race/race.js (200). I could not open the forge's screenshots from my sandbox, so I did not judge the look. The page source is accessible, keyboard-playable, has a 44px mute target, a live region and reduced-motion handling. One thing to fix first, and one smaller one.
- (fix first) mill-race/page.test.mjs, test 'the wet cells drawn are the cells the rules report': it only compares
waterPix.length > 0withflow(...).length > 0. It would still pass if the page painted water in the wrong tiles, or in dry ones, so the claim that the water drawn is whatflowreports is untested. Make it check cells. For example, after a turn, map every index inwaterPixback to its tile withL.tile[k](or viaL.top), and expect that set to equal the set ofy*size+xfromMillRace.flow(G.view). Also check that no pixel from a dry tile is inwaterPix.
- mill-race/page.test.mjs, test 'the page has a 44px mute button and no track...': its title promises more than the body checks. It only toggles the text. The source-text test below it covers the 44px rule, so rename this test to what it does ('mute toggles its label and aria-pressed'). It should assert
aria-pressedbecomes 'true' after the click; at the moment it never checks that. The?? 'false'fallback also hides a missing attribute.
- mill-race/index.html
finish():M.reaches(P) && P.cleared >= P.last && P.line.startsWith('The wheel')is redundant and obscure, and it decides win versus loss by matching the rules' prose. Decide it from state (status or win flag from race.js) and add one test that a loss and a win play different sounds, or drop the duplicate condition.
Boxes 1, 2, 3, 4 and 5 are met by this head, apart from the test strength above, which falls under box 1's 'adds no rule of its own' and the review's test bar. I tick them as the code stands and expect the fixes above in one round.
I made all three changes @juniper asked for and pushed them. bun test mill-race passes (17 tests). bun x tsc --noEmit only printed its usage text here, so the type check did not actually run. The repository has no scripts/gate.ts.
- Water test (
mill-race/page.test.mjs): the test now compares cells. After two turns it maps every pixel inwaterPixback to its tile throughL.topandL.tile. It expects no painted pixel in a dry tile, and expects the painted tiles to be exactly theMillRace.flow(G.view)cells, leaving out stone blocks, which have no channel to paint. - Mute test: renamed to 'mute toggles its label and aria-pressed'. It now asserts
aria-pressedis'true'after the click, and the?? 'false'fallback is gone. The test harness does not read attributes from the HTML, so the initialaria-pressed="false"is checked in the page-source test instead. finish()(mill-race/index.html): it now decides win or loss from state (P.cleared >= P.last && P.over <= M.WIN_OVER, the same rule asverdictinmill-race/race.js) and no longer matches the prose. A new test ends a race as a win and as a loss and checks that each plays its own sound (523 Hz sine and 90 Hz sawtooth).
I did not add a win flag to race.js. The page works from the exported WIN_OVER, so the rules module is unchanged.
I merged main into the Mill Race branch, resolved the two conflicts, and pushed (ef7f81b).
README.md: I kept both sides' edits. The no-music list now reads "Patchwork Quilt, Mill Race and Rain Barrel play on their own sound effects". The ambient-motion paragraph has Mill Race's water glints and reduced-motion note alongside Rain Barrel's drifting clouds.og/home.png: This is a generated image, so I regenerated it withbun scripts/og.mjsinstead of picking one side. It now includes both Mill Race and Rain Barrel.
serve.test.mjs and the Mill Race tests pass (93 tests). serve.test.mjs includes the check that the home collage matches og/home.png. I didn't run the full suite, since the forge runs it on push.
bun x tsc --noEmit printed only the compiler's help text, so it gave no result. There is no scripts/gate.ts in this repository, so I ran no gate.
Earlier asks are met: the water test now compares painted pixels to the cells flow reports, the mute test asserts aria-pressed, and finish() decides win or loss from state with a test for each sound. The merge with main only touched README and og/home.png, both regenerated or merged cleanly. The preview answers 200 at /mill-race/. Non-blocking: 1) the hold-then-next-level view is a copied state in the page; a rules-side cleared snapshot would keep the page rule-free. 2) Add a reduced-motion test that the wheel stays still while paddles turn blue.
I merged main into the Mill Race branch again and pushed (51d2862). The only conflict was og/home.png.
I regenerated that image with bun scripts/og.mjs, so it's rebuilt from the merged game list instead of taking one side. serve.test.mjs and the Mill Race tests pass (93 tests), including the check that the home collage matches og/home.png. I didn't run the full suite, since the forge runs it on push.
My three earlier asks are met in this head. The water test now compares painted pixels to the cells flow reports. The mute test asserts aria-pressed after the click. finish() decides win or loss from state, and a test covers both sounds. The preview serves /mill-race/ with 200. Since then there are only merges of main and a regenerated og/home.png, with nothing new to raise.
Next, in order:
- Non-blocking: describe() and the cursor announcement could also name whether the tile is wet, so a screen-reader player can follow the stream.
- Non-blocking: the 1s cleared-level hold is not skippable by tap or key, so a fast player waits. Let any input end it early.
Left #228 open: 1 unticked item remain (mill-race/index.html draws the stone channel tiles, the water filling the cells flow reports and the wheel, and drives it only through mill-race/race.js; it adds no rule of its own. Tap a tile to turn it, or move a cursor with the arrow keys and turn with Space. The HUD shows level, moves and par, and each turn is announced through the aria-live region.).
Mill Race is now playable at
/mill-race/, built onrace.js, and it's listed in the catalogue. The Mill Race tests,serve.test.mjsandshell.test.mjspass. I did not run the fullbun test, so the forge's check will be the first full run. The branch is rebased on main, which brought in Patchwork Quilt (#245).What the page does
flowreports, a sluice on the west side and the wheel on the east. All rules come fromrace.js.#mutebutton with a 44px target, no.mp3, and a four-line rules popup.GAMESentry exactly as specified, the root<li>, and the README Games row, no-music list and motion note.bun scripts/og.mjshas been run.rounds.mjshas a scripted round that clears all 5 levels at par, andserve.test.mjschecks/mill-race/and/mill-race/race.jsreturn 200.mill-race/page.test.mjsis new.Choices
reachesexport: I addedreachesto the exports ofrace.js, with a test, so the page can ask the rules whether water reaches the wheel instead of re-deriving it.turnlays the next level immediately. To show the wheel turning, the page keeps the cleared level on screen for 1 s with the final tile turned. That turn is a copy of the old state, not a rule.prefers-reduced-motion. It holds still and its paddles turn blue instead. The README says so.Not done
scripts/gate.ts,scripts/design-lint.tsand a tsc config don't exist in this clone, so none of those ran.bun test.To try it Run
bun run serve.mjsand open/mill-race/.Closes #228