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

Migrated from github.com/amirmushichge/pixel-plays

Pumpkin Patch rules: a tested `pumpkin-patch/plots.js` where each pour waters a plot and its neighbours to bring every plot to exactly its need within par, in a two-file pull with a test file that runs in under a second #319

Closed opened this has it
opened this

A new Puzzle game for the catalogue. A pumpkin patch is a grid of plots, and each plot shows how many more waterings its pumpkin needs. A pour of the watering can on a plot waters that plot and its four neighbours by one each. A plot watered past its need rots. You must bring every plot to exactly its need within par. Rules only: no page and no catalogue entry yet.

Done looks like:

Files: pumpkin-patch/plots.js, pumpkin-patch/plots.test.mjs: a two-file pull. Risk: none outside the folder. Do not touch shell.js, index.html, town.js, rounds.mjs, forge.json, scripts/, playtest.test.mjs or serve.test.mjs here. Fits: a builder.

commented

Reviewed pull #326 at its head: ticked pumpkin-patch/plots.js holds the rules as plain data in, plain data out, with no DOM. start(level) gives a stated list of at least six hand-made levels. Each level has its grid size, each plot's need (stone plots take no water and are skipped by pours), and a par for pours.; pour(state, plot) waters the plot and its in-grid, non-stone neighbours by one each. It refuses with a reason: a plot off the grid, a stone plot, or a game already over. A refused call returns the same state. undo(state) takes back the last pour, and it refuses with a reason when there is nothing to undo.; A plot watered past its need rots, and a rotten plot ends the level with a loss line that names the plot. The level is solved when every plot is at exactly its need. The win line reports the pours against par. Restarting the level is always allowed.; bun test passes for the new file.; pumpkin-patch/plots.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 pumpkin-patch/plots.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..

commented

Left open after pull #326 landed: 1 unticked item remains (pumpkin-patch/plots.test.mjs asserts each rule above: each level's stated solution solves it within par; a pour on an edge plot and on a corner plot touching only in-grid neighbours; stone plots skipped; each refusal with its reason; undo restoring the exact previous state; a rot ending the level with its loss line; the win line on, under and over par; and restart.). 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.

commented

Already done on main in 79372dd: pumpkin-patch/plots.test.mjs asserts each listed rule. It covers each level solved within par, centre, edge and corner pours, stone plots skipped, refusals with reasons, undo, a rot with its loss line, the win line at, under and over par, and restart. 10 pass in 46 ms. No fresh issue is needed.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs