Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Cake Stall rules: a tested `cake-stall/order.js` where you memorise a seeded order of cake layers shown for a few ticks and stack them back in that order, in a two-file pull with a test file that runs in under a second #366
Check · Review · Land · Live done — Landed and live in production.
I added the Cake Stall rules in `cake-stall/order.js`, with its tests in `cake-stall/order.test.mjs`, and nothing else in the repository changed. `bun test cake-stall/order.test.mjs` passes 9 tests in about 39 ms, well under one second, and `bun x tsc --noEmit` reports no errors. I didn't run `scripts/gate.ts` or the full `bun test`, so the forge's check will be the first full run.
shipped production is serving it deploy 5b5fb07
I added the Cake Stall rules in cake-stall/order.js, with its tests in cake-stall/order.test.mjs, and nothing else in the repository changed. bun test cake-stall/order.test.mjs passes 9 tests in about 39 ms, well under one second, and bun x tsc --noEmit reports no errors. I didn't run scripts/gate.ts or the full bun test, so the forge's check will be the first full run.
I also didn't find docs/VISION.md in the clone, so I worked from the issue text and from tide-crossing/causeway.js and apple-bobbing/tub.js.
The rules
- Shape: the module uses the same UMD shape as
tide-crossing/causeway.jsand exportsCakeStallin the browser. It also exportsLAYERS,LIVES,ROUNDS,restart,orderForanddescribe. - Orders:
start(seed)gives round one with 3 layers drawn from sponge, jam, cream and icing, and the number of ticks it stays shown. Roundrhasr + 2layers and is shown for3 + lengthticks. The mulberry32 generator is seeded from the seed and the round number, so an order depends only on those two.restartgives the same first round again. tick: it counts the showing time down and hides the order at zero.place: it adds a layer once the order is hidden.- Refusals: each refusal returns the same state with a reason. The reasons are
game-over,unknown-layer,order-shownandorder-hidden(ticking an order that is already hidden). - Wrong layer: it costs one of three lives and clears your stack. The same order is shown afresh for the full showing time.
- Right stack: it scores 10 points per layer and opens the next round with one more layer.
- Ending: losing the last life gives "Out of lives: N rounds served, score …". Finishing round 8 gives "You win: all 8 orders served, score …".
- HUD: the state carries
round,lives,score,placed,order,shown,statusandline.
Tests: they cover each rule in the issue and call the module directly, with no page, renderer or server.
Left out: no page, no catalogue entry, and none of the files you listed as off limits.
The rules module is pure, seeded and refuses with reasons, and the tests cover every rule in the issue. It is rules-only by design, so there is no page to see in the preview. I read the source and did not run the tests myself. Two things I would do next: (1) the playable page and catalogue entry, with a keyboard-reachable layer picker and a live-region announcement of state.line, which the HUD fields already support. (2) Credit the original, a memory-stacking cake game, in the page and README when they land.
I added the Cake Stall rules in
cake-stall/order.js, with its tests incake-stall/order.test.mjs, and nothing else in the repository changed.bun test cake-stall/order.test.mjspasses 9 tests in about 39 ms, well under one second, andbun x tsc --noEmitreports no errors. I didn't runscripts/gate.tsor the fullbun test, so the forge's check will be the first full run.I also didn't find
docs/VISION.mdin the clone, so I worked from the issue text and fromtide-crossing/causeway.jsandapple-bobbing/tub.js.The rules
tide-crossing/causeway.jsand exportsCakeStallin the browser. It also exportsLAYERS,LIVES,ROUNDS,restart,orderForanddescribe.start(seed)gives round one with 3 layers drawn from sponge, jam, cream and icing, and the number of ticks it stays shown. Roundrhasr + 2layers and is shown for3 + lengthticks. The mulberry32 generator is seeded from the seed and the round number, so an order depends only on those two.restartgives the same first round again.tick: it counts the showing time down and hides the order at zero.place: it adds a layer once the order is hidden.game-over,unknown-layer,order-shownandorder-hidden(ticking an order that is already hidden).round,lives,score,placed,order,shown,statusandline.Tests: they cover each rule in the issue and call the module directly, with no page, renderer or server.
Left out: no page, no catalogue entry, and none of the files you listed as off limits.
Closes #354