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 #232
Merged 32d 21h ago, live in production
This adds the Patchwork Quilt rules as quilt/patch.js and quilt/patch.test.mjs, with no page and no catalogue entry. bun test quilt passes (10 tests) and bun x tsc --noEmit is clean. There is no scripts/gate.ts or scripts/fast.ts in this clone, so I ran neither, and I did not run the full suite.
-
Reviews
ApprovedRules-only pull, like the other rules pulls (rain-barrel, etc.): plain data in and out, no DOM, seeded, no dependency. The scramble is built from 5 swaps and 5 turns, so undoing it takes at most 20 moves, inside the 24-move limit. The test replays the solution for 100 seeds. Refused moves return the same state object. Not run here: I could not fetch the branch into my sandbox, so I did not run the tests myself. I relied on the pull being green and on reading the diff. The preview answers 200 and has no quilt page yet, which is expected for this scope.
Two things to do next:
- Add the playable page and catalogue entry for the quilt. Make it usable by keyboard and on a 360px phone: each patch needs a focusable button with an accessible name, because rotate and swap must not depend on a pointer. Show the win and loss line in an aria-live region.
- Give the tty door the same moves, and credit the original puzzle family (edge-matching tile puzzles such as Eternity) on the page.
Small note: the gain-score test only asserts that some rotation scores at least GAIN_SCORE. Assert the exact score for one known gain.
-
Checks
shipped production is serving it deploy 7b8dc66
-
History
- Patchwork Quilt rules: a tested quilt/patch.js where you rotate and swap square patches until every stitched edge matches, from plain data f9d429d
- Rain Barrel rules: a tested `rain-barrel/gutter.js` where rain runs off a roof's gutters and you slide one barrel under each spout before it overflows the yard, from plain data (#226) 773d6b9
- Add Bird Watch: the playable page and its place in the catalogue, on the rules in `bird-watch/watch.js` (#229) fa2d5a9
- Add Bunting: the playable page and its place in the catalogue, on the rules in `bunting/line.js` (#214) 95e8cf7
- Add Curling Rink: the playable page and its place in the catalogue, on the rules in `curling/rink.js` (#210) 4c08c9c
- Add Ferris Wheel: the playable page and its place in the catalogue, on the rules in `ferris-wheel/wheel.js` (#209) 5bdecf5
- Add Lily Pond: the playable page and its place in the catalogue, on the rules in `lily-pond/pond.js` (#186) 6826f87
- Add Shunting Yard: the playable page and its place in the catalogue, on the rules in `shunting-yard/yard.js` (#185) 8ede704
- Add Market Barrow: the playable page and its place in the catalogue, on the rules in `market-barrow/barrow.js` (#206) 9a10fcc
- Add Hedge Maze: the playable page and its place in the catalogue, on the rules in `hedge-maze/maze.js` (#184) 9435c25
- Carousel rules: a tested `carousel/ride.js` where a rider on a turning carousel grabs brass rings from the dispenser at the right moment, from plain data (#196) 2b2b892
- Add Allotment: the playable page and its place in the catalogue, on the rules in `allotment/plot.js` (#182) f17bb59
- Curling Rink rules: a tested `curling/rink.js` that slides stones down the ice with sweeping and collisions, from plain data (#194) 2b8d368
- Ferris Wheel rules: a tested `ferris-wheel/wheel.js` that seats a queue of riders and keeps the wheel balanced, from plain data (#192) 4323674
- Bird Watch rules: a tested `bird-watch/watch.js` that shows birds on perches for a moment and asks where each one sat, from plain data (#195) 815381d
- Mill Race rules: a tested `mill-race/race.js` that turns pipe tiles to carry the stream to the water wheel, from plain data (#191) f646af0
- Bunting rules: a tested `bunting/line.js` that hangs flags on a string so no two neighbours match, from plain data (#197) 2dd4ace
- Add Sandcastle Tide: the playable page and its place in the catalogue, on the rules in `sandcastle/tide.js` (#183) 62ed252
- Market Barrow rules: a tested `market-barrow/barrow.js` that buys and sells a barrow of goods across village stalls over ten days, from plain data (#172) dcd7a2d
- Add Tower Duel: the playable page and its place in the catalogue, on the rules in `tower-duel/duel.js` (#156) 651fe84
This adds the Patchwork Quilt rules as quilt/patch.js and quilt/patch.test.mjs, with no page and no catalogue entry. bun test quilt passes (10 tests) and bun x tsc --noEmit is clean. There is no scripts/gate.ts or scripts/fast.ts in this clone, so I ran neither, and I did not run the full suite.
Rules
- Start:
start(seed)gives a 3×3 quilt, 4 stitch patterns, a 24-move limit and 12 shared edges. The quilt is sewn so every shared edge matches, then scrambled from the seed. It is never left already finished. - Solvable: the scramble is 5 swaps and 5 quarter turns in a seeded order. Undoing it takes at most 20 moves (a swap undoes in one, a quarter turn in three), so 24 always suffices.
solution(seed)returns those undo moves, and the test replays it for 100 seeds. - Moves: a cell is its index 0–8, counted along rows.
rotate(state, cell)turns the patch a quarter turn clockwise, andswap(state, a, b)exchanges two patches. Each counts as one move. - Refusals: a cell off the grid returns
bad-cell, and swapping a patch with itself returnssame-cell. Both hand back the same state object. Any move after the game has ended returnsover. - Matching:
matches(state)lists every shared edge as{a, b, ok}. An edge matches when the two touching stitches are equal. - Scoring: a move that raises the matching count scores 10. Finishing scores 5 for each move left, so a win on move 20 earns 20 on top of the 10 from the move that finished it. The win line is
Quilt finished: N points, M moves to spare. The loss line, once the limit is reached first, isOut of moves: X of 12 edges match, N points. A win on the last allowed move counts as a win.
Not done
- No hint button or UI, though
solutioncould drive a hint later. - No larger grids or difficulty levels.
shell.js,index.html,town.jsandrounds.mjsare untouched.
Try it: bun test quilt.
This adds the Patchwork Quilt rules as
quilt/patch.jsandquilt/patch.test.mjs, with no page and no catalogue entry.bun test quiltpasses (10 tests) andbun x tsc --noEmitis clean. There is noscripts/gate.tsorscripts/fast.tsin this clone, so I ran neither, and I did not run the full suite.Rules
start(seed)gives a 3×3 quilt, 4 stitch patterns, a 24-move limit and 12 shared edges. The quilt is sewn so every shared edge matches, then scrambled from the seed. It is never left already finished.solution(seed)returns those undo moves, and the test replays it for 100 seeds.rotate(state, cell)turns the patch a quarter turn clockwise, andswap(state, a, b)exchanges two patches. Each counts as one move.bad-cell, and swapping a patch with itself returnssame-cell. Both hand back the same state object. Any move after the game has ended returnsover.matches(state)lists every shared edge as{a, b, ok}. An edge matches when the two touching stitches are equal.Quilt finished: N points, M moves to spare. The loss line, once the limit is reached first, isOut of moves: X of 12 edges match, N points. A win on the last allowed move counts as a win.Not done
solutioncould drive a hint later.shell.js,index.html,town.jsandrounds.mjsare untouched.Try it:
bun test quilt.Closes #217