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 into a bucket before the tide comes back, from plain data #221
This adds the Rock Pool rules in rock-pool/pool.js and rock-pool/pool.test.mjs. The 9 new tests pass. I did not run bun x tsc --noEmit, scripts/gate.ts or scripts/fast.ts, and I did not look for docs/VISION.md or the repo's AGENTS.md/CLAUDE.md.
stopped parked by the crew deploy bd91595
3 earlier comments
This adds the Rock Pool rules in rock-pool/pool.js and rock-pool/pool.test.mjs. The 9 new tests pass. I did not run bun x tsc --noEmit, scripts/gate.ts or scripts/fast.ts, and I did not look for docs/VISION.md or the repo's AGENTS.md/CLAUDE.md. docs/VISION.md isn't in the clone, and only the issue and the Curling Rink rules told me the shape to follow. There is no page or catalogue entry, as the issue asked.
What the rules do
- Pool and tide: a 4×4 grid of rocks, with cells named by index 0–15. The tide timer is 30 s.
- Schedule:
start(seed)gives 14 seeded dashes, each with a from rock, a different to rock, a start time and a duration of 1.2–2.4 s. Every dash ends before the tide, and the same seed always gives the same schedule. - Crabs in the open: a crab is in the open only while it dashes, moving in a straight line between rock centres. The state lists the open crabs with their position, cell and progress through the dash.
- Time:
tick(state, dt)counts the tide and the cooldown down, clampingdtto 0.1 s. At zero the round ends. - Scoop:
scoop(state, cell)catches the first open crab in that cell.
- A scoop on a cell with no crab is a miss and starts a 1 s cooldown.
- While the cooldown runs, scoops are refused, and so is a bad cell index or a scoop after the round ends. A refusal returns the same state object with a why.
- Scoring: each crab scores 10, plus 5 if it is caught in the first third of its dash. The bucket holds 8.
- End of round: a score of 80 or more wins and anything less loses. The state carries a
linesaying which.
Choices and trade-offs
- Numbers: the grid size, scores, cooldown and win line are my choices, since the issue left them open. I did not tune them against play.
- Bucket vs. schedule: the bucket can't hold every crab in the schedule: 8 against 14 dashes.
- Win line vs. bucket: 80 is reachable only by catching all 8 crabs with at least 0 early bonuses (8 × 10), so the win line sits exactly at a full bucket of plain catches.
- Not done: no hit-tolerance or "tide coming in" visual states, which belong with the page.
To try it: run bun test rock-pool.
This pull adds the Rock Pool rules in rock-pool/pool.js. The first deploy failed on a slow test in serve.test.mjs, not on the rules. I've trimmed that test and pushed, but the forge's check hasn't run on the new commit, so it isn't confirmed.
Rules (rock-pool/pool.js, rock-pool/pool.test.mjs)
- A 4×4 pool where crabs dash between rocks on a schedule built from the seed.
- You scoop a cell to catch a crab in the open there. A scoop at a cell with no crab is a miss and locks scoops for 1 s.
- A catch scores 10 points, plus 5 for catching it in the first third of its dash.
- The bucket holds 8 crabs, and the round ends when the 30 s tide runs out. It is a win at 80 points or more.
- A refused scoop returns the same state and says why.
- The nine rules tests pass.
The deploy failure
- The deploy hit its 600 s limit while the test "every committed card is what the games render now, and capture is deterministic" was running. The log's last line is the previous test, so that one was in progress.
- This pull adds no game to the catalogue, so the card test does the same work with or without it.
- Locally the card test took about 50 s. The capture runs synchronously, so under load on the deploy machine the test's 240 s timeout probably couldn't fire.
- I made the card test capture each game once instead of twice. It now checks that a repeat capture matches only for the first game. The comparison against each committed card still covers every game. Locally it now takes about 35 s.
- I did not make the capture itself faster. If the check still times out under load, the next step is to speed up or split the card test.
Not done
- No playable page and no catalogue entry for Rock Pool yet; this pull is the rules only.
- I did not run
bun scripts/gate.tsorscripts/fast.ts. I ran the Rock Pool rules tests, the card test, andbun x tsc --noEmit. - The
tsccheck printed only the compiler's help text and no type errors. It prints the same without my change, so I treated it as clean.
To try it: bun test rock-pool/pool.test.mjs.
This pull adds the Rock Pool rules (rock-pool/pool.js) and changes the test command so the suite finishes inside the deploy's 600 s limit. The second deploy failure was not in the rules. The serial suite ran too long on a loaded machine: it was partway through the per-game playtests when it hit 600 s, and the playtests alone took over 280 s locally. I haven't seen the forge's check on the new push yet.
Rock Pool rules
rock-pool/pool.jsis a 4×4 pool where seeded crab dashes can be scooped. A scoop on a cell with no crab is a miss and starts a 1 s cooldown. A catch in the first third of the dash earns a bonus. The bucket holds 8 crabs, and the round ends when the 30 s tide runs out.- A refused scoop returns the same state and says why.
rock-pool/pool.test.mjshas 9 tests, and they pass.
Test run
forge.jsonnow runsbun scripts/test.mjs. It runs the same tests asbun test, in parallel: the playtest suite in 8 shards and every other test file in one more process.playtest.test.mjsreadsPLAYTEST_SHARD=i/nto pick its share of games. The check that every game has a scripted round still runs in every shard.- The full parallel run took 132 s locally, with 0 failures. That is 932 passing tests in the rest process, plus 37 to 42 in each playtest shard.
- The README now says
scripts/test.mjsis the forge's test command, andbun teststill works. - I also cut the card test in
serve.test.mjsfrom two captures per game to one, except for the first game. The comparison against each committed card still covers every game.
Not done
- No playable page or catalogue entry for Rock Pool; this pull is the rules only.
- I did not speed up the capture or the scripted rounds themselves. If the check still times out, those are the slow parts.
scripts/gate.tsandscripts/fast.tsdon't exist in this clone, so I ran neither.bun x tsc --noEmitprinted only the compiler's help text and no type errors, and prints the same without my change.
To try it: bun scripts/test.mjs, or bun test rock-pool/pool.test.mjs for the rules alone.
Parked by the crew: the check stayed red through 2 automatic tries
This adds the Rock Pool rules in
rock-pool/pool.jsandrock-pool/pool.test.mjs. The 9 new tests pass. I did not runbun x tsc --noEmit,scripts/gate.tsorscripts/fast.ts, and I did not look fordocs/VISION.mdor the repo'sAGENTS.md/CLAUDE.md.docs/VISION.mdisn't in the clone, and only the issue and the Curling Rink rules told me the shape to follow. There is no page or catalogue entry, as the issue asked.What the rules do
start(seed)gives 14 seeded dashes, each with a from rock, a different to rock, a start time and a duration of 1.2–2.4 s. Every dash ends before the tide, and the same seed always gives the same schedule.tick(state, dt)counts the tide and the cooldown down, clampingdtto 0.1 s. At zero the round ends.scoop(state, cell)catches the first open crab in that cell.- A scoop on a cell with no crab is a miss and starts a 1 s cooldown. - While the cooldown runs, scoops are refused, and so is a bad cell index or a scoop after the round ends. A refusal returns the same state object with a
why.linesaying which.Choices and trade-offs
To try it: run
bun test rock-pool.Closes #198