Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Duck Race rules: a tested `duck-race/stream.js` where you steer a rubber duck across stream lanes past rocks and eddies against three rivals, from plain data, in a two-file pull with a test file that runs in under a second #248
Reviewed pull #260 at its head: ticked tick(state, dt) carries every duck downstream at its lane's current: fast water speeds a duck up by a stated factor, an eddy holds a duck spinning for a stated time, a rock stops a duck until it changes lane. steer(state, -1 | 1) moves your duck one lane, refused past the banks and during a stated cooldown. Rivals change lanes by a seeded rule the test can predict.; The race ends when every duck has passed the bridge or a stated time limit runs out. A finishing order is reported; first place scores a stated amount, with a stated bonus for never touching a rock. A win line for first place, a loss line otherwise, each with your place.; duck-race/stream.test.mjs asserts each rule above: the same seed giving the same stream, fast water, an eddy holding a duck, a rock stopping one, steering refused at a bank and in cooldown, the finishing order, the bonus, and the win and loss lines.; bun test passes for the new file.; duck-race/stream.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 duck-race/stream.test.mjs). The pull states the measured time.; If the check fails only on "test took longer than 600s" or a CPU limit, the pull says so. Do not cut the rules or their tests to get under the limit..
Left open after pull #260 landed: 1 unticked item remains (duck-race/stream.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives a stated stream length, a stated number of lanes, a seeded layout of rocks, eddies and fast water along it, and your duck plus three rival ducks at the start line; the same seed always gives the same stream and the same rival behaviour.). The planner files each as its own issue and closes this one; a person may close it, tick what is done, or say what is left. Until then the crew does not pick it again.
A new Racing game for the catalogue: rubber ducks race down a stream, and you steer yours across lanes around rocks and out of eddies to reach the bridge first. Rules only: no page and no catalogue entry yet.
Done looks like:
duck-race/stream.jsholds the rules as plain data in, plain data out, with no DOM.start(seed)gives a stated stream length, a stated number of lanes, a seeded layout of rocks, eddies and fast water along it, and your duck plus three rival ducks at the start line; the same seed always gives the same stream and the same rival behaviour.tick(state, dt)carries every duck downstream at its lane's current: fast water speeds a duck up by a stated factor, an eddy holds a duck spinning for a stated time, a rock stops a duck until it changes lane.steer(state, -1 | 1)moves your duck one lane, refused past the banks and during a stated cooldown. Rivals change lanes by a seeded rule the test can predict.duck-race/stream.test.mjsasserts each rule above: the same seed giving the same stream, fast water, an eddy holding a duck, a rock stopping one, steering refused at a bank and in cooldown, the finishing order, the bonus, and the win and loss lines.bun testpasses for the new file.duck-race/stream.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 duck-race/stream.test.mjs). The pull states the measured time.Files:
duck-race/stream.js,duck-race/stream.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.