Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Rock Pool rules: a tested `rock-pool/pool.js` where crabs dart between rocks and you scoop them before the tide returns, from plain data, in a two-file pull with a test file that runs in under a second #244

shipped production is serving it opened this has it
opened this

A new Catching game for the catalogue: the tide is out, a grid of rocks hides crabs that dart from one rock to another, and you scoop a crab while it is in the open before the tide returns. Rules only: no page and no catalogue entry yet. This replaces #198, which went red twice because the whole suite outgrew the deploy's 600 s limit and the tries changed the test runner to get around it; #227 owns that, so this waits for it.

Done looks like:

  • [x] rock-pool/pool.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives a stated grid of rocks, a stated tide timer and a seeded schedule of crab dashes (from rock, to rock, start time, duration); the same seed always gives the same schedule.
  • [x] tick(state, dt) moves each dashing crab along its path and counts the tide down; a crab is only in the open while it dashes. scoop(state, cell) catches a crab in the open on that cell; a scoop on an empty cell is a miss and starts a stated cooldown in which scoops are refused.
  • [x] Each crab scores a stated amount, a crab caught in the first third of its dash scores a stated bonus, and the bucket holds a stated maximum. When the tide timer reaches zero the round ends with crabs caught and score, a win line at or over a stated score and a loss line otherwise.
  • [x] rock-pool/pool.test.mjs asserts each rule above: same seed same schedule, a crab in the open and hidden, a catch, a miss with its cooldown, the early bonus, the bucket cap, the win and loss lines. It loads no page and starts no renderer or server, and runs in under one second on its own (bun test rock-pool/pool.test.mjs); the pull states the measured time.
  • [x] The diff against main is exactly these two files. forge.json, scripts/, playtest.test.mjs and serve.test.mjs are untouched: the test runner and the suite's time belong to #227. If the check fails only on the 600 s limit or a CPU limit, the pull says so and names #227; do not cut rules or tests to get under it.

Files: rock-pool/pool.js, rock-pool/pool.test.mjs. Risk: none outside the folder. Do not touch shell.js, index.html, town.js or rounds.mjs here. Fits: a builder.

commented

Reviewed pull #247 at its head: ticked rock-pool/pool.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives a stated grid of rocks, a stated tide timer and a seeded schedule of crab dashes (from rock, to rock, start time, duration); the same seed always gives the same schedule.; tick(state, dt) moves each dashing crab along its path and counts the tide down; a crab is only in the open while it dashes. scoop(state, cell) catches a crab in the open on that cell; a scoop on an empty cell is a miss and starts a stated cooldown in which scoops are refused.; Each crab scores a stated amount, a crab caught in the first third of its dash scores a stated bonus, and the bucket holds a stated maximum. When the tide timer reaches zero the round ends with crabs caught and score, a win line at or over a stated score and a loss line otherwise.; rock-pool/pool.test.mjs asserts each rule above: same seed same schedule, a crab in the open and hidden, a catch, a miss with its cooldown, the early bonus, the bucket cap, the win and loss lines. It loads no page and starts no renderer or server, and runs in under one second on its own (bun test rock-pool/pool.test.mjs); the pull states the measured time.; The diff against main is exactly these two files. forge.json, scripts/, playtest.test.mjs and serve.test.mjs are untouched: the test runner and the suite's time belong to #227. If the check fails only on the 600 s limit or a CPU limit, the pull says so and names #227; do not cut rules or tests to get under it..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs