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

Migrated from github.com/amirmushichge/pixel-plays

Carrot Pull rules: a tested `carrot-pull/bed.js` where you pull carrots when ripe before a seeded rabbit nibbles them, in a two-file pull with a test file that runs in under a second #340

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Carrot Pull rules are in `carrot-pull/bed.js`, with `carrot-pull/bed.test.mjs`. That's the two files, and nothing else is touched. The 12 tests pass.

shipped production is serving it deploy 5b5fb07

opened this

Carrot Pull rules are in carrot-pull/bed.js, with carrot-pull/bed.test.mjs. That's the two files, and nothing else is touched. The 12 tests pass.

bun test carrot-pull/bed.test.mjs ran in 45 ms inside the test runner, 0.05 s wall-clock including startup. The test file imports the rules module directly and loads no page, renderer or server.

I did not run these checks:

  • Gate: this clone has no scripts/gate.ts, so the gate didn't run.
  • Type check: bun x tsc --noEmit only printed its help text (there's no tsconfig), so it checked nothing.
  • Design lint: not needed, since nothing under src/web/ changed.

The branch was already pushed (git push said everything was up to date).

What I chose not to do: there is no page and no catalogue entry, as the issue asks for rules only. To try it, run bun test carrot-pull/bed.test.mjs.

Closes #327

commented

Carrot Pull rules are in carrot-pull/bed.js, with carrot-pull/bed.test.mjs. That's the two files, and nothing else is touched. The 12 tests pass.

bun test carrot-pull/bed.test.mjs ran in 45 ms inside the test runner, 0.05 s wall-clock including startup. The test file imports the rules module directly and loads no page, renderer or server.

I did not run these checks:

  • Gate: this clone has no scripts/gate.ts, so the gate didn't run.
  • Type check: bun x tsc --noEmit only printed its help text (there's no tsconfig), so it checked nothing.
  • Design lint: not needed, since nothing under src/web/ changed.

The branch was already pushed (git push said everything was up to date).

What I chose not to do: there is no page and no catalogue entry, as the issue asks for rules only. To try it, run bun test carrot-pull/bed.test.mjs.

Approved

Rules module is pure (no DOM, timers or Math.random), seeded, and matches the sibling rules files' shape. Refusals return the same state with a reason, and the tests cover every box; measured time of 45 ms is stated. Nit for later, not blocking: the end line says '1 carrots pulled ripe' (bed.js describe); pluralise it and update the test string.

commented

Left #327 open: 2 unticked items remain (step(state) advances one tick: carrots grow and the rabbit moves, nibbling a ripe or woody carrot on its square. walk(state, dir) moves the gardener one square. pull(state) pulls the carrot on the gardener's square. Each refuses with a reason: an unknown direction, a move off the bed, nothing to pull, or a day already over. A refused call returns the same state.; Pulling a ripe carrot scores a stated amount. Pulling a sprout scores nothing and leaves the square empty. Pulling a woody carrot scores a stated lesser amount. A carrot the rabbit nibbles is lost. The day ends when the ticks run out, with an end line that reports the score, carrots pulled ripe and carrots lost to the rabbit.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs