Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Apple Bobbing rules: a tested `apple-bobbing/tub.js` where you dunk for seeded bobbing apples at the top of their bob before your breaths run out, in a two-file pull with a test file that runs in under a second #333
Reviewed pull #357 at its head: ticked apple-bobbing/tub.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives a tub of a stated number of apples. Each apple has a seeded period and phase in ticks and a stated catch window around the top of its bob. A round has a stated number of breaths and a stated number of ticks. Randomness comes only from the seed, so the same seed and inputs give the same round. There are no timers and no Math.random. It exports the same way as pumpkin-patch/plots.js.; step(state) advances one tick. aim(state, i) picks apple i. dunk(state) tries the aimed apple: inside its window it is caught and scores a stated amount, more for the exact top. Outside its window it is a miss and costs one breath. Each refuses with a reason: an unknown apple, an apple already caught, dunking with nothing aimed, or a round already over. A refused call returns the same state.; The round ends when every apple is caught, the breaths run out or the ticks run out. The end line reports the score, apples caught and breaths left.; bun test passes for the new file.; apple-bobbing/tub.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 apple-bobbing/tub.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 #357 landed: 1 unticked item remains (apple-bobbing/tub.test.mjs asserts each rule above. It checks that the same seed gives the same tub and round, and checks a dunk at the exact top, at the window's edge and just outside it. It also checks a miss costing a breath, each refusal with its reason, and each of the three endings with its end line.). 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.
Already done on main in e1c635e: apple-bobbing/tub.test.mjs landed covering seed, dunk window, breaths, refusals and endings; bun test passes.
Already done on main in e1c635e: apple-bobbing/tub.test.mjs asserts every rule in the open box (same seed, exact top, window edge and just outside, refusals, the three endings). The remaining box is met; nothing left to build here.
A new Timing game for the catalogue. A tub of water holds apples that bob up and down on seeded, stated periods. You pick an apple and dunk on a tick. The dunk catches it only when it is at the top of its bob, and a miss splashes and costs a breath. Rules only: no page and no catalogue entry yet.
Done looks like:
Files:
apple-bobbing/tub.js,apple-bobbing/tub.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.