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 #223
I added the Patchwork Quilt rules in quilt/patch.js, with tests in quilt/patch.test.mjs. All 9 tests pass. bun x tsc --noEmit printed only its help text (the clone has no tsconfig), so I never saw a type check run.
stopped parked by the crew deploy a605af8
3 earlier comments
I added the Patchwork Quilt rules in quilt/patch.js, with tests in quilt/patch.test.mjs. All 9 tests pass. bun x tsc --noEmit printed only its help text (the clone has no tsconfig), so I never saw a type check run. I did not run design-lint, because I didn't touch src/web/, and the clone has no scripts/gate.ts or scripts/fast.ts, so neither ran. docs/VISION.md and AGENTS.md don't exist in the clone, so I followed the shape of lily-pond/pond.js instead.
- Start:
start(seed)gives a 3×3 quilt with a 40-move limit and 12 shared edges. Each edge carries one of 4 stitches. It builds a solved quilt, shuffles the patches and turns each one. The same seed always gives the same scramble, and a scramble is never already finished. - Solvable: each patch remembers its home cell, so
solution(state)returns the moves that restore the original quilt. The tests run it on 200 seeds, and every one ends in a win within the limit. - Moves:
rotate(state, cell)turns a patch a quarter turn clockwise, andswap(state, a, b)exchanges two patches. Each counts one move. Cells are{x, y}. A cell off the grid is refused withwhy: 'off-grid'and the very same state comes back. Swapping a cell with itself and moving after the game is over are also refused. - Edges:
matches(state)returns the count, the total and each seam with whether it matches. - Scoring: a move scores 10 for each edge it newly matches, and finishing adds 5 for every move left.
- End lines: a win line appears when all 12 edges match, and a win on the last move still counts. The loss line appears when the move limit is reached first.
I chose not to build a page or catalogue entry, and I left shell.js, index.html, town.js and rounds.mjs alone, as the issue says.
To try it, run bun test quilt.
🤖 Generated with Claude Code
This pull adds the Patchwork Quilt rules in quilt/patch.js, with 9 tests in quilt/patch.test.mjs. It has no page, catalogue entry or MCP route yet, so nobody can play it from the feed.
The failed deploy. The preview's test run hit its 600s limit, not a failing assertion. The log stops at the test "every committed card is what the games render now…". That test renders every game's opening frame, one after another, in a single blocking call. It ran in about 49s here on its own. This pull adds no game and touches nothing that test reads, so I found no cause in the diff. I think the deploy machine was loaded; I didn't confirm it.
What I did. I made no code change. I pushed an empty commit (5792266) to re-run the preview. The quilt tests pass here. The repository has no scripts/gate.ts, and tsc has no config to check against. I didn't run the other test files.
If it times out again, the fix belongs to the card test or the deploy time limit, not to the quilt code. The test's own 240s limit can't stop it, because the work blocks the thread.
Not done: the page that draws and plays the quilt.
🤖 Generated with Claude Code
The deploy timeout was caused by the suite getting too long, not by the quilt code. forge.json now runs the tests through a new script that splits the slowest file across parallel processes. The full run takes 106s here with 932 tests passing; I haven't seen the preview deploy yet.
The timeout. playtest.test.mjs plays every game one after another in a software renderer, and by itself it took 551s here. On the deploy machine that, plus serve.test.mjs and the rest of the suite, went past 600s. The earlier failure at the card-capture test was the same cause. Both runs stopped at different tests, so nothing in the quilt change is hanging. The quilt change adds no game page, and the playtest only covers game pages.
What changed:
playtest.test.mjsreads aPLAYTEST_SHARD="i/n"setting and plays only its share of the games. The check that every game has a scripted round, and the reverse, still looks at all of them. Run on its own with no setting, it behaves as before.scripts/test.mjsis new. It runs the playtest in up to 6 parallel shards next to the rest of the suite, and exits non-zero if any slice fails.forge.jsonnow runsbun scripts/test.mjsas its test command instead ofbun test.
Parallel runs make timing-sensitive tests slower per test, but the longest slice was 90s in my run. This also adds a script and a way to run the suite that others on the repository will meet.
Not done: the page that draws and plays the quilt. The rules are in quilt/patch.js with 9 tests in quilt/patch.test.mjs, but nobody can reach them from the feed or the MCP yet.
🤖 Generated with Claude Code
Parked by the crew: the check stayed red through 2 automatic tries
I added the Patchwork Quilt rules in
quilt/patch.js, with tests inquilt/patch.test.mjs. All 9 tests pass.bun x tsc --noEmitprinted only its help text (the clone has no tsconfig), so I never saw a type check run. I did not rundesign-lint, because I didn't touchsrc/web/, and the clone has noscripts/gate.tsorscripts/fast.ts, so neither ran.docs/VISION.mdandAGENTS.mddon't exist in the clone, so I followed the shape oflily-pond/pond.jsinstead.start(seed)gives a 3×3 quilt with a 40-move limit and 12 shared edges. Each edge carries one of 4 stitches. It builds a solved quilt, shuffles the patches and turns each one. The same seed always gives the same scramble, and a scramble is never already finished.solution(state)returns the moves that restore the original quilt. The tests run it on 200 seeds, and every one ends in a win within the limit.rotate(state, cell)turns a patch a quarter turn clockwise, andswap(state, a, b)exchanges two patches. Each counts one move. Cells are{x, y}. A cell off the grid is refused withwhy: 'off-grid'and the very same state comes back. Swapping a cell with itself and moving after the game is over are also refused.matches(state)returns the count, the total and each seam with whether it matches.I chose not to build a page or catalogue entry, and I left
shell.js,index.html,town.jsandrounds.mjsalone, as the issue says.To try it, run
bun test quilt.🤖 Generated with Claude Code
Closes #217