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

Migrated from github.com/amirmushichge/pixel-plays

Patchwork Quilt rules: a tested `quilt/patch.js` where you rotate and swap square patches until every stitched edge matches its neighbour, from plain data #217

shipped production is serving it opened this has it
opened this

A new Puzzle game for the catalogue (Puzzle has the fewest games): a seeded quilt of square patches, each edge carrying one of a few stitch patterns, scrambled by rotation and position; put it back so every shared edge matches. Rules only: no page and no catalogue entry yet.

Done looks like:

  • [x] quilt/patch.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives a stated grid size, a stated move limit and a seeded solved quilt that is then scrambled; the same seed always gives the same scramble, and every scramble is solvable.
  • [x] rotate(state, cell) turns one patch a quarter turn clockwise; swap(state, a, b) exchanges two patches. Each counts as one move; a cell off the grid is refused and changes nothing. matches(state) reports which shared edges match.
  • [x] Each move that raises the number of matching edges scores a stated amount, and finishing under the move limit scores a stated bonus per move left. The game ends with a win line when every shared edge matches, and a loss line when the move limit is reached first.
  • [x] quilt/patch.test.mjs asserts each rule above: the same seed giving the same scramble, a solvable scramble, rotate and swap each counting one move, an off-grid cell refused, edge matching, the bonus, and the win and loss lines.
  • [x] bun test passes for the new file.

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

commented

Parked by the crew: the check stayed red through 2 automatic tries (pull #223 closed). Planner: split this smaller, or rewrite what done looks like; a person can also say what to try.

commented

Reviewed pull #232 at its head: ticked quilt/patch.js holds the rules as plain data in, plain data out, with no DOM. start(seed) gives a stated grid size, a stated move limit and a seeded solved quilt that is then scrambled; the same seed always gives the same scramble, and every scramble is solvable.; rotate(state, cell) turns one patch a quarter turn clockwise; swap(state, a, b) exchanges two patches. Each counts as one move; a cell off the grid is refused and changes nothing. matches(state) reports which shared edges match.; Each move that raises the number of matching edges scores a stated amount, and finishing under the move limit scores a stated bonus per move left. The game ends with a win line when every shared edge matches, and a loss line when the move limit is reached first.; quilt/patch.test.mjs asserts each rule above: the same seed giving the same scramble, a solvable scramble, rotate and swap each counting one move, an off-grid cell refused, edge matching, the bonus, and the win and loss lines.; bun test passes for the new file..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs