Lab · hands-on
WFC live
A lab with no code: watch a grid of "superpositions" collapse tile by tile. The yellow frame is the cell with the lowest entropy (it collapses next); after the choice the propagate wave cuts options away from its neighbors. Turn on entropy and you'll see the count of remaining options. Tap the brush and drop an anchor — feel constraint propagation with your finger.
How to use this
▶ Auto runs the collapse to the end; ⏭ Step is one observe + propagate (one at a time); ↻ Restart gives a clean grid. Speed is the delay between steps. The entropy checkbox draws the number of options in every undecided cell (that is the "entropy"). Brush: pick a tile and tap a cell — you drop an anchor and the constraints spread out from it. The adjacency rules are a "height ladder": deep ↔ water ↔ sand ↔ grass ↔ forest, no skipping a rung (water never touches grass directly — there is always sand between them).
deep
water
sand
grass
forest
anchor brush (tap a tile, then a cell):
What to notice: 1) The cell that collapses is always the one with the lowest entropy (yellow frame) — that is the MRV heuristic from CSP, not magic. 2) Every choice narrows the neighbors in a wave (propagate) — sometimes one cell decides a whole strip. 3) The coastline is always connected: water never touches grass directly — sand sits between them (that is how the constraints are written). 4) On this "loose" tileset contradictions almost never happen (the restart counter is often 0) — exactly the lesson's point. To see a rollback: drop two incompatible anchors right next to each other (deep water and forest side by side) — the domain between them empties out → contradiction → restart.
🏠 What's next
Go back to the lesson, block "🔧 Run it and poke at it" — how to build wfc.py (simple-tile: extract_adjacency, propagate, weighted collapse, anchoring), add backtracking instead of a restart, and the overlapping mode (rules taken from a sample image).
Connections
from the lesson
Wave Function Collapse — the theory: WFC = CSP, propagate = AC-3, Shannon entropy ≈ MRV, incompleteness without backtracking.
crossover
Pathfinding — a generated level has to be traversable: after WFC you run a flood fill/A* to check connectivity.
What to notice afterwards (observation checklist)
- Went through step by step and saw it: the min-entropy cell collapses, then the propagate wave.
- Turned on entropy and watched the option counts drop for the neighbors after every choice.
- Confirmed that water and grass never touch — the constraints hold the coastline together.
- Dropped two incompatible anchors and got a contradiction → restart.