Wave collapse
An explainable tile-map generator: a seeded run is deterministic, uses only allowed adjacencies, and paints a golden map.
This is an interactive visual spec on Spekkr, published by nova. It is listed with the other specs. Paste the line to an agent that can open a web address, and the agent fetches the files and builds from them.
- Spec
nova/wave-collapse- Version
- 0.2.1
- Published by
- nova
- Updated
- 15 Nov 2026
Build this spec
Build the spec at https://spekkr.com/nova/wave-collapse/start.md.
Paste this to your AI agent. It opens the address, fetches the spec's files, records your choices and builds from them. Nothing to install, no account.
Published by nova.
What does the result look like?
What can I customize?
Your choices go into the line you copy. Anything else is yours to edit, but it leaves the tested path.
What do I get?
-
spec.mdRequirements and acceptance checks.Wave collapse
What this builds
A grid of cells, each a superposition of tiles. At each step the cell of lowest entropy is chosen, a tile is picked from the seed, and neighbours are constrained by an adjacency table. If a cell has no tile left, the run retries from the start, up to a documented limit, or reports a contradiction. The tilesets are original. A seeded run is deterministic and never places a forbidden pair.
Read
spekkr.inputs.jsonfirst.titlelabels the grid.width,heightandseedsize and pin the run.tilesetchooses the rules.explainandstepchange the chrome.Out of scope
- A 3D or irregular mesh in this version.
- Network or a public tileset workshop in the checks.
- A licensed commercial tileset.
Requirements
Each requirement has an id. Checks name the id they cover.
R1. Adjacency and determinism
- A placed pair of neighbours is always in the tileset's allowed list, for each of the four sides.
- The same tileset, size and seed produce the same sequence of placements, and the same final grid or the same contradiction after the same number of retries.
- Seed 7, coast, 16 by 16, finishes in the grid
fixtures/wfc-coast-7.txtwith no retry.
Accept when: the seed-7 grid matches the file, and a scan of every edge is in the allowed list.
R2. Contradiction and retry
- A fixture tileset
broken(tests only) has no complete tiling of a 3 by 3 grid and must reportcontradictionafter 8 retries. - A retry starts from a full superposition and consumes the seed from where it left off, as in
design.md. - The UI can show a contradiction cell; screenshot
contradictionis taken from this fixture.
Accept when: the broken 3 by 3 reports contradiction after 8 retries, and the retry count is in the result.
R3. Frames and files
- Frames: the starting superposition, a mid-collapse of seed 7 at step 40, the contradiction fixture, and the finished seed-7 map.
- One command runs adjacency, seed, retry, and writes the frames. No network.
Accept when: the command passes for both shipped tilesets (rooms has its own seed-7 file).
R4. Inputs
- The build reads
spekkr.inputs.json. Settings label the UI, options turn features on or off, and a swap must be one of its choices. - A value outside a stated range, or a swap that is not one of its choices, is refused before the app starts its checks, with a message that names the key.
Accept when: the default inputs render, an illegal swap is refused by name, and changing a visible setting (for example the title) shows up in a later check.
Verification
A seeded run is deterministic and uses only allowed adjacencies, checked on every edge of the finished grid. A contradiction fixture retries the documented number of times and then reports failure. A golden map is compared, and the tile-id grid is compared exactly. No network.
Definition of done
- Every acceptance check above runs from one command, and all pass at the person's inputs.
- A README says how to collapse a map, how to add a tileset, and how to run the checks.
# Wave collapse ## What this builds A grid of cells, each a superposition of tiles. At each step the cell of lowest entropy is chosen, a tile is picked from the seed, and neighbours are constrained by an adjacency table. If a cell has no tile left, the run retries from the start, up to a documented limit, or reports a contradiction. The tilesets are original. A seeded run is deterministic and never places a forbidden pair. Read `spekkr.inputs.json` first. `title` labels the grid. `width`, `height` and `seed` size and pin the run. `tileset` chooses the rules. `explain` and `step` change the chrome. ## Out of scope - A 3D or irregular mesh in this version. - Network or a public tileset workshop in the checks. - A licensed commercial tileset. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Adjacency and determinism - A placed pair of neighbours is always in the tileset's allowed list, for each of the four sides. - The same tileset, size and seed produce the same sequence of placements, and the same final grid or the same contradiction after the same number of retries. - Seed 7, coast, 16 by 16, finishes in the grid `fixtures/wfc-coast-7.txt` with no retry. Accept when: the seed-7 grid matches the file, and a scan of every edge is in the allowed list. ### R2. Contradiction and retry - A fixture tileset `broken` (tests only) has no complete tiling of a 3 by 3 grid and must report `contradiction` after 8 retries. - A retry starts from a full superposition and consumes the seed from where it left off, as in `design.md`. - The UI can show a contradiction cell; screenshot `contradiction` is taken from this fixture. Accept when: the broken 3 by 3 reports contradiction after 8 retries, and the retry count is in the result. ### R3. Frames and files - Frames: the starting superposition, a mid-collapse of seed 7 at step 40, the contradiction fixture, and the finished seed-7 map. - One command runs adjacency, seed, retry, and writes the frames. No network. Accept when: the command passes for both shipped tilesets (rooms has its own seed-7 file). ### R4. Inputs - The build reads `spekkr.inputs.json`. Settings label the UI, options turn features on or off, and a swap must be one of its choices. - A value outside a stated range, or a swap that is not one of its choices, is refused before the app starts its checks, with a message that names the key. Accept when: the default inputs render, an illegal swap is refused by name, and changing a visible setting (for example the title) shows up in a later check. ## Verification A seeded run is deterministic and uses only allowed adjacencies, checked on every edge of the finished grid. A contradiction fixture retries the documented number of times and then reports failure. A golden map is compared, and the tile-id grid is compared exactly. No network. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to collapse a map, how to add a tileset, and how to run the checks.
-
design.mdTilesets, adjacency, the seeded grid, and contradiction retries.Design
This file fixes the parts that are easy to get wrong. The language and tools are up to you, as long as the numbers here hold.
Tilesets
tilesets/coast.jsonandtilesets/rooms.jsonlist tile ids, edges, and allowed neighbour pairs. Tests read those files. The broken fixture istilesets/broken.json.Seed 7
The finished grids are
fixtures/wfc-coast-7.txtandfixtures/wfc-rooms-7.txt. The placement sequence (cell, tile) is in the sibling.jsonfiles, so a mid-collapse at step 40 is defined.Retry
A retry increments
retries, does not reset the seed cursor, and stops at- A contradiction result includes the last empty cell's coordinates.
Screenshot tolerance
8 levels, 98% of pixels. The finished map's tile ids must also match the file exactly.
Inputs
Key Label Default Notes titleTitle A map that collapses Shown above the grid. widthGrid width 16 From 4 to 48. heightGrid height 16 From 4 to 48. seedSeed 7 A whole number. explainShow entropy on A faint number on an uncollapsed cell, the count of remaining tiles. stepStep mode on A control advances one collapse at a time. Tests use this. tilesetTileset coast A shipped set of tiles and adjacency rules. Acceptance at the defaults
The numbers, names and fixture paths already in this file are the authority. Where a later table or a shipped fixture file disagrees with prose, the table or the fixture wins.
Fixture Role design.mdA shipped fixture. The build may move it, but then design.mdmust name the new path.fixtures/wfc-coast-7.txtA shipped fixture. The build may move it, but then design.mdmust name the new path.fixtures/wfc-rooms-7.txtA shipped fixture. The build may move it, but then design.mdmust name the new path.spekkr.inputs.jsonA shipped fixture. The build may move it, but then design.mdmust name the new path.tilesets/broken.jsonA shipped fixture. The build may move it, but then design.mdmust name the new path.tilesets/coast.jsonA shipped fixture. The build may move it, but then design.mdmust name the new path.tilesets/rooms.jsonA shipped fixture. The build may move it, but then design.mdmust name the new path.Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement names another size. Tolerance, unless a tighter figure is given above: 8 levels, 98% of pixels, with motion, cursors and clocks frozen as this file says. A build's goldens are of that build; they do not have to match a shipped reference preview pixel-for-pixel if the tool or the type is different, but they do have to match this file's layout, counts and copy.
Screenshots
These pictures are headless-Chrome captures of the working reference in
reference/preview.html, at the default inputs. They are not drawings of a product that has not been built. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel.File What it shows shots/map.pngA 16×16 seeded collapse, seed 7, the south-east still open. How to verify
- Run the checks at the default inputs, without a network.
- Walk through the scripted playthroughs, fixture lookups or goldens named in the requirements; each must match this file.
- Repeat once at the person's inputs when they differ from the defaults.
- A seeded run is deterministic and uses only allowed adjacencies, checked on every edge of the finished grid. A contradiction fixture retries the documented number of times and then reports failure. A golden map is compared, and the tile-id grid is compared exactly. No network.
# Design This file fixes the parts that are easy to get wrong. The language and tools are up to you, as long as the numbers here hold. ## Tilesets `tilesets/coast.json` and `tilesets/rooms.json` list tile ids, edges, and allowed neighbour pairs. Tests read those files. The broken fixture is `tilesets/broken.json`. ## Seed 7 The finished grids are `fixtures/wfc-coast-7.txt` and `fixtures/wfc-rooms-7.txt`. The placement sequence (cell, tile) is in the sibling `.json` files, so a mid-collapse at step 40 is defined. ## Retry A retry increments `retries`, does not reset the seed cursor, and stops at 8. A contradiction result includes the last empty cell's coordinates. ## Screenshot tolerance 8 levels, 98% of pixels. The finished map's tile ids must also match the file exactly. ## Inputs | Key | Label | Default | Notes | | --- | --- | --- | --- | | `title` | Title | A map that collapses | Shown above the grid. | | `width` | Grid width | 16 | From 4 to 48. | | `height` | Grid height | 16 | From 4 to 48. | | `seed` | Seed | 7 | A whole number. | | `explain` | Show entropy | on | A faint number on an uncollapsed cell, the count of remaining tiles. | | `step` | Step mode | on | A control advances one collapse at a time. Tests use this. | | `tileset` | Tileset | coast | A shipped set of tiles and adjacency rules. | ## Acceptance at the defaults The numbers, names and fixture paths already in this file are the authority. Where a later table or a shipped fixture file disagrees with prose, the table or the fixture wins. | Fixture | Role | | --- | --- | | `design.md` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | | `fixtures/wfc-coast-7.txt` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | | `fixtures/wfc-rooms-7.txt` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | | `spekkr.inputs.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | | `tilesets/broken.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | | `tilesets/coast.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | | `tilesets/rooms.json` | A shipped fixture. The build may move it, but then `design.md` must name the new path. | Golden frames are compared at 1400 by 1000 CSS pixels unless a requirement names another size. Tolerance, unless a tighter figure is given above: 8 levels, 98% of pixels, with motion, cursors and clocks frozen as this file says. A build's goldens are of that build; they do not have to match a shipped reference preview pixel-for-pixel if the tool or the type is different, but they do have to match this file's layout, counts and copy. ## Screenshots These pictures are headless-Chrome captures of the working reference in `reference/preview.html`, at the default inputs. They are not drawings of a product that has not been built. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel. | File | What it shows | | --- | --- | | `shots/map.png` | A 16×16 seeded collapse, seed 7, the south-east still open. | ## How to verify 1. Run the checks at the default inputs, without a network. 2. Walk through the scripted playthroughs, fixture lookups or goldens named in the requirements; each must match this file. 3. Repeat once at the person's inputs when they differ from the defaults. 4. A seeded run is deterministic and uses only allowed adjacencies, checked on every edge of the finished grid. A contradiction fixture retries the documented number of times and then reports failure. A golden map is compared, and the tile-id grid is compared exactly. No network.
-
tasks.mdBuild tasks in order, each with a check.Tasks
Work in order. Finish a task's check before starting the next.
- Set up. Set up a web app (or the stack you have chosen) and a test runner that can open a page, click, and compare screenshots. Read
spekkr.inputs.jsonfirst. Check: a blank or heading page loads, and an empty test run passes. - Adjacency and determinism (R1). Build what
R1. Adjacency and determinismasks for, to the numbers indesign.md. In particular: A placed pair of neighbours is always in the tileset's allowed list, for each of the four sides. Check: theR1. Adjacency and determinismacceptance checks pass. - Contradiction and retry (R2). Build what
R2. Contradiction and retryasks for, to the numbers indesign.md. In particular: A fixture tilesetbroken(tests only) has no complete tiling of a 3 by 3 grid and must reportcontradictionafter 8 retries. Check: theR2. Contradiction and retryacceptance checks pass. - Frames and files (R3). Build what
R3. Frames and filesasks for, to the numbers indesign.md. In particular: Frames: the starting superposition, a mid-collapse of seed 7 at step 40, the contradiction fixture, and the finished seed-7 map. Check: theR3. Frames and filesacceptance checks pass. - Inputs (R4). Build what
R4. Inputsasks for, to the numbers indesign.md. In particular: The build readsspekkr.inputs.json. Settings label the UI, options turn features on or off, and a swap must be one of its choices. Check: theR4. Inputsacceptance checks pass. - Goldens. Capture the frames named in
design.mdat the defaults, with motion frozen where the file says so. Compare them within the stated tolerance. Check: the frames match, and a pixel-level check fails if a documented element is removed on purpose. - Finish. Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in
spec.mdis true.
# Tasks Work in order. Finish a task's check before starting the next. 1. **Set up.** Set up a web app (or the stack you have chosen) and a test runner that can open a page, click, and compare screenshots. Read `spekkr.inputs.json` first. Check: a blank or heading page loads, and an empty test run passes. 2. **Adjacency and determinism (R1).** Build what `R1. Adjacency and determinism` asks for, to the numbers in `design.md`. In particular: A placed pair of neighbours is always in the tileset's allowed list, for each of the four sides. Check: the `R1. Adjacency and determinism` acceptance checks pass. 3. **Contradiction and retry (R2).** Build what `R2. Contradiction and retry` asks for, to the numbers in `design.md`. In particular: A fixture tileset `broken` (tests only) has no complete tiling of a 3 by 3 grid and must report `contradiction` after 8 retries. Check: the `R2. Contradiction and retry` acceptance checks pass. 4. **Frames and files (R3).** Build what `R3. Frames and files` asks for, to the numbers in `design.md`. In particular: Frames: the starting superposition, a mid-collapse of seed 7 at step 40, the contradiction fixture, and the finished seed-7 map. Check: the `R3. Frames and files` acceptance checks pass. 5. **Inputs (R4).** Build what `R4. Inputs` asks for, to the numbers in `design.md`. In particular: The build reads `spekkr.inputs.json`. Settings label the UI, options turn features on or off, and a swap must be one of its choices. Check: the `R4. Inputs` acceptance checks pass. 6. **Goldens.** Capture the frames named in `design.md` at the defaults, with motion frozen where the file says so. Compare them within the stated tolerance. Check: the frames match, and a pixel-level check fails if a documented element is removed on purpose. 7. **Finish.** Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in `spec.md` is true.
- Set up. Set up a web app (or the stack you have chosen) and a test runner that can open a page, click, and compare screenshots. Read
-
reference/preview.htmlA working reference preview of the default view, used to make the listing pictures. A build does not have to start from this file. -
reference/fonts/fonts.cssWebfont faces for the reference preview. -
reference/fonts/Geist.ttfGeist variable typeface for the reference preview. -
reference/fonts/Fraunces.ttfFraunces variable typeface for the reference preview. -
reference/fonts/Fraunces-Italic.ttfFraunces italic variable typeface for the reference preview.
Is it for me?
- Platforms
- web
- Tools
- TypeScript
What does it need?
- Agent permissions
- shell
- Commands it runs
install a test runnerinstall a tool that compares screenshots
What changed?
- 0.2.115 Nov 2026Names what it builds.
- 0.2.014 Nov 2026Polished reference preview and new listing shots, including a short loop.
- 0.1.014 Nov 2026First version.
For agents: start.md says how to build this spec, spec.json holds everything on this page, and bundle.tar.gz holds its files.