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 #354
Reviewed pull #366 at its head: ticked cake-stall/order.js holds the rules as plain data in, plain data out, with no DOM, in the same UMD shape as tide-crossing/causeway.js (exporting CakeStall in the browser). start(seed) gives round one: an order of at least three layers from at least four layer kinds, and the number of ticks it stays shown. Randomness comes only from the seed, so the same seed gives the same orders; no Math.random.; tick(state) counts the showing time down and hides the order at zero. place(state, layer) adds a layer to your stack once the order is hidden. Each call refuses with a reason and returns the same state: an unknown layer, placing while the order is still shown, or a game already over.; A wrong layer costs one of three lives and the round starts again with the same order shown afresh; a finished correct stack scores the round and the next order is one layer longer. The game ends with a line naming the rounds served when lives run out, and is won with a win line after the eighth round. The state reports round, lives, score and the layers placed for the HUD.; cake-stall/order.test.mjs asserts each rule above: same seed same orders; each refusal with its reason; the order hides when its ticks run out; a wrong layer costs a life and reshows the order; a right stack lengthens the next order by one; the loss line and the win line.; cake-stall/order.test.mjs loads no page and starts no renderer or server: it calls the rules module directly and runs in under one second on its own (bun test cake-stall/order.test.mjs). The pull states the measured time. bun test passes..
A new Memory game for the catalogue. At the village fete cake stall a customer's order (a seeded stack of sponge, jam, cream and icing layers) is shown, then hidden; you stack the layers from memory, and each round the orders grow longer. Rules only: no page and no catalogue entry yet.
Done looks like:
cake-stall/order.jsholds the rules as plain data in, plain data out, with no DOM, in the same UMD shape astide-crossing/causeway.js(exportingCakeStallin the browser).start(seed)gives round one: an order of at least three layers from at least four layer kinds, and the number of ticks it stays shown. Randomness comes only from the seed, so the same seed gives the same orders; no Math.random.tick(state)counts the showing time down and hides the order at zero.place(state, layer)adds a layer to your stack once the order is hidden. Each call refuses with a reason and returns the same state: an unknown layer, placing while the order is still shown, or a game already over.cake-stall/order.test.mjsasserts each rule above: same seed same orders; each refusal with its reason; the order hides when its ticks run out; a wrong layer costs a life and reshows the order; a right stack lengthens the next order by one; the loss line and the win line.cake-stall/order.test.mjsloads no page and starts no renderer or server: it calls the rules module directly and runs in under one second on its own (bun test cake-stall/order.test.mjs). The pull states the measured time.bun testpasses.Files:
cake-stall/order.js,cake-stall/order.test.mjs: a two-file pull. Risk: none outside the folder. Do not touchshell.js,index.html,town.js,rounds.mjs,forge.json,scripts/,playtest.test.mjsorserve.test.mjshere. Fits: a builder.