Skip to main content
All guides

How to Prove Peel-Match Puzzles Are 100% Solvable with Bounded DFS & Blind-Bot Curves

Engineering architecture behind viral Pixel Flow / Knit Out puzzles: BFS outer-air flood-fill exposure, color parity checks, bounded heuristic DFS 5-slot solvability gates, and 40-run blind-bot difficulty waves.

Casual layered-peel puzzles (such as Pixel Flow! or knitted wool-unravel games) live or die by a razor-thin emotional line: players must feel one slot away from jamming without ever hitting an unfair, mathematically impossible board.

If you shuffle tray queues naively, you ship unwinnable 0% levels within ten minutes of generation. Here is the exact 4-stage pipeline we use in production鈥攁nd you can play it live in our interactive EP22 Puzzle Curve & DFS Solver Lab.

1. Exposed-Edge Peeling via Outer-Air BFS Flood Fill

Instead of hardcoding brittle layer trees per handcrafted drawing, determine which board tiles are peelable by flooding empty/cleared cells from the perimeter inwards:

// Seed outer-border air or border tiles, then 4-neighbor BFS across null cells
// Any remaining non-null tile adjacent to an air cell (or on the perimeter) is EXPOSED.

Because exposure updates dynamically every time a tile clears, players can carve tunnels deep into any pixel tapestry鈥攃reating emergent "Oh! That opened the inside ring!" aha moments.

2. Three Non-Negotiable Offline Math Gates

Every generated level must pass three CI checks before hitting production:

GateRequirementWhy It Matters
Color Conservation Paritysum(board[c].bites) === sum(trayBoxes[c].count)Prevents phantom un-clearable tiles or leftover dead boxes
Bounded Heuristic DFS (5 slots)Finds a zero-booster clear sequence within <= 3000 nodesGuarantees every stage is 100% solvable without paying for boosters
Monte Carlo Blind-Bot Win Rate40 random-legal runs against target cadenceShapes tension without cruelty

For the DFS heuristic, prioritize candidate columns in this order:

  1. Immediate board win (+100000)
  2. Free holding slots remaining (freeSlots * 40)
  3. Exposed tiles peeled on this move (eaten * 6)
  4. Penalty (-50) for feeding a sleeping (Zzz) color that has zero exposed matches

3. Tuning the Blind-Bot Difficulty Wave

A pure 100% win rate feels mindless; a 0% trap makes players uninstall. By adjusting queue box sizes (chunk) and swap span (weave), you sculpt an addiction-grade progression wave:

  • Tutorial Stages (100% blind-bot rate): Large pure chunks matching the outermost colors immediately.
  • Breather Stages (~80%): Mild interleaving so casual players breeze through after a tough stage.
  • Chapter Climax (~36% blind-bot + 100% DFS solvable): Double-layer knots (ice = 1, needing 2 hits) on inner boundaries + moderate weave so naive clicking threatens a 5-slot jam, while intentional sequencing clears cleanly.

Try It Live or Ship It Today