If you have ever played a Nonogram (Picross) puzzle on the web, you know the single most frustrating moment: you solve 92% of the board cleanly, and then you hit a 2×2 ambiguous rectangle where both solutions satisfy every row and column clue. You are forced to guess.
When I built Star Picross for 2Day Games (a collection of 7 minimalist browser logic puzzles totaling 3,500 stages), my #1 engineering rule was simple:
Every single one of the 500 stages must be 100% solvable using line-by-line logical deduction — zero guessing, zero backtracking required from the player.
Here is how the verification pipeline works under the hood.
Why Naive Random Generation Fails
Generating a random 10×10 binary grid and extracting row/column run-length clues takes 10 lines of code. The problem is that roughly 35%–50% of random 10×10 Nonograms either have multiple solutions or require deep bifurcation (trial-and-error guessing).
Even checking uniqueness with a backtracking solver isn't enough! A puzzle can have a unique solution mathematically while still forcing a human player to assume a cell is filled and look 12 steps ahead to find a contradiction.
The Pure-Logic Line Propagation Verifier
Instead of trusting a backtracking solver, I wrote a strict human-logic line solver that mirrors how a skilled Nonogram player actually thinks:
- Start with every cell in the
N×Nboard markedUNKNOWN(-1). - For each row (and then each column), generate all valid line placements of its run-length clues that are consistent with the cells already confirmed as
FILLED(1) orEMPTY(0). - Compute the intersection of all valid placements for that line:
- If every valid placement has
1at indexi, celliis provablyFILLED. - If every valid placement has
0at indexi, celliis provablyEMPTY.
- If every valid placement has
- Repeat alternating rows and columns until a full pass makes zero new deductions.
function deduceLine(length: number, clues: number[], current: Int8Array): Int8Array | null { let andFilled = new Uint8Array(length).fill(1); let andEmpty = new Uint8Array(length).fill(1); let validCount = 0; // Recursively enumerate valid clue placements matching `current` function place(clueIdx: number, pos: number, line: Uint8Array) { // ... prune immediately on conflict with `current` ... // on full valid line: validCount++; for (let i = 0; i < length; i++) { if (line[i] === 1) andEmpty[i] = 0; else andFilled[i] = 0; } } if (validCount === 0) return null; const next = new Int8Array(current); for (let i = 0; i < length; i++) { if (andFilled[i]) next[i] = 1; else if (andEmpty[i]) next[i] = 0; } return next; } If the fixed-point loop terminates with zero UNKNOWN cells remaining, the puzzle is guaranteed to be:
- Mathematically unique (no alternate solution can exist), AND
- 100% solvable by pure line-by-line deduction without a single guess.
Grading Difficulty Across 500 Stages (5×5 to 10×10)
Because the line solver tracks how many propagation passes it needed to finish a board, we get an objective difficulty metric for free:
- Chapters 1–5 (
5×5&6×6): 2–3 passes, generous anchor clues for quick warmups. - Chapters 6–15 (
7×7&8×8): 4–7 passes, requiring cross-axis deduction. - Chapters 16–25 (
9×9&10×10): 8+ passes with sparse clues and tight edge-logic.
All 500 verified stages are pre-baked into 5 tiny static JSON micro-shards (100 stages each) served from CDN edge cache — so loading any stage costs 0 database reads and starts in milliseconds.
Try It Live
You can test the verified stages directly in your browser (no login, no download):
- Play Star Picross (500 Pure-Logic Nonogram Stages)
- Browse all 7 logic puzzles (3,500 stages total) on 2Day Games
If you have ever built a constraint solver for grid puzzles, I'd love to hear how you balance pure-logic solvability against difficulty scaling!
