Most browser puzzle generators fail at the exact moment a logic game is supposed to be satisfying. You spend four minutes carefully narrowing down a 15x15 Nonogram or clearing a Minesweeper board down to the last two squares, only to hit a symmetrical 50/50 split where no deduction exists. You click, lose, and close the tab.
That failure is structural, not accidental. Naive generators treat puzzle creation as random sampling: scatter mines across a grid, poke holes in a completed Sudoku, or convert a random bitmap into row and column clues. Sampling produces grids that are solvable—at least one valid solution exists—but it makes no guarantee that the solution is unique, or that a human can reach it without trial-and-error bifurcation.
At Fogboard, an independent browser-based daily logic puzzle studio covering 11 English logic and fog-of-war games plus 3 Japanese editions, we treated solver verification as a hard gate inside the client-side generator. A board is never rendered until a Vanilla JS solver proves it meets its game-specific invariant: exact-cover uniqueness for Shikaku rectangle divisions, iterative coral wall sealing to lock a unique Hamiltonian path across 5x5 to 7x7 grids in Zip Game, unique-solution verification for Queens Puzzle's non-touching colored regions, and pure deductive solvability for Nonograms and Minesweeper.
Here is how four of those client-side verifiers work under the hood.
Nonograms: Proving Zero-Guess Solvability with Line-by-Line DP
A Nonogram (5x5, 10x10, or 15x15) can have a strictly unique solution and still feel unfair. If resolving a board requires guessing a cell, tracing implications across six rows, hitting a contradiction, and backtracking, the player experiences it as trial and error rather than logic.
To guarantee zero guessing is ever required, our verifier forbids backtracking completely. It only accepts boards solvable by pure single-line constraint propagation using forward/backward dynamic programming (DP).
Consider a single line of length NN with current cell states in {UNKNOWN,EMPTY,FILLED}\{\text{UNKNOWN}, \text{EMPTY}, \text{FILLED}\} and a clue list c1,c2,…,ckc_1, c_2, \dots, c_k. Rather than enumerating all valid placements—which blows up combinatorially on sparse 15x15 lines—we compute two boolean DP tables:
- Forward feasibility (
pref[i][j]): whether the first jjclues can be legally placed within the prefix of cells 0…i−10 \dots i-1without placing a filled run over a knownEMPTYcell or leaving a knownFILLEDcell uncovered. - Backward feasibility (
suff[i][j]): the mirror computation from right to left, testing whether the remaining clues j…k−1j \dots k-1fit within the suffix i…N−1i \dots N-1.
A placement of clue cjc_j starting at index pp is globally valid for the line if and only if:
-
pref[p][j]is true (with a separator cell before ppif j≥1j \ge 1, meaning index p−1p-1cannot beFILLED), - None of the cells in [p,p+cj−1]
[p, p + c_j - 1]isEMPTY, and -
suff[p + c_j][j + 1]is true (with index p+cjp + c_jnotFILLEDwhen p+cj≤N−1p + c_j \le N - 1).
Using prefix sums of EMPTY and FILLED counts, each placement check runs in O(1)O(1) time. As we sweep every valid (p, j) placement, we mark a difference array canFill across [p,p+cj−1][p, p + c_j - 1]. Simultaneously, any cell xx where pref[x][j] && suff[x + 1][j] holds (and cell xx is not FILLED) sets canEmpty[x] = true.
After one pass over the DP tables:
- If
canFill[x]is true andcanEmpty[x]is false, cell xxis forcedFILLEDacross every valid line configuration. - If
canEmpty[x]is true andcanFill[x]is false, cell xxis forcedEMPTY.
Every time a cell changes state, its perpendicular line enters a work queue. The solver loops until the queue drains. If any cell remains UNKNOWN at the fixed point, the candidate bitmap is rejected immediately. Every published 5x5, 10x10, and 15x15 board is therefore mathematically proved solvable by line-by-line deduction alone.
Sudoku: 9-Bit Bitmask MRV Backtracking for Uniqueness
For Mini Sudoku 6x6 (with 2x3 boxes) and Classic Sudoku 9x9, removing clues from a completed grid requires proving that no second solution exists. In JavaScript, allocating arrays of candidate sets inside a recursive backtracking loop creates GC pressure during generation. Representing constraints as integer bitmasks eliminates allocations altogether.
For Classic 9x9, each row, column, and 3x3 box is tracked as a 9-bit integer (rowMask[9], colMask[9], boxMask[9]), where bit dd represents digit d+1d + 1. Finding every legal candidate for cell (r, c) reduces to a single bitwise expression:
JavaScript
const FULL_MASK = 0x1FF; // 9 bits set (0x3F for 6x6 Mini Sudoku) function countSolutions(board, rowMask, colMask, boxMask, limit = 2) { let bestIdx = -1; let bestMask = 0; let minCount = 10; for (let i = 0; i < 81; i++) { if (board[i] !== 0) continue; const r = (i / 9) | 0; const c = i % 9; const b = ((r / 3) | 0) * 3 + ((c / 3) | 0); const avail = ~(rowMask[r] | colMask[c] | boxMask[b]) & FULL_MASK; if (avail === 0) return 0; // dead end const count = POPCOUNT_9BIT[avail]; if (count < minCount) { minCount = count; bestIdx = i; bestMask = avail; if (count === 1) break; // forced naked single } } if (bestIdx === -1) return 1; // board solved const r = (bestIdx / 9) | 0; const c = bestIdx % 9; const b = ((r / 3) | 0) * 3 + ((c / 3) | 0); let solutions = 0; for (let m = bestMask; m !== 0; m ^= m & -m) { const bit = m & -m; board[bestIdx] = bit; rowMask[r] ^= bit; colMask[c] ^= bit; boxMask[b] ^= bit; solutions += countSolutions(board, rowMask, colMask, boxMask, limit - solutions); board[bestIdx] = 0; rowMask[r] ^= bit; colMask[c] ^= bit; boxMask[b] ^= bit; if (solutions >= limit) return solutions; } return solutions; } Two details make this fast enough to run synchronously during generation:
- Minimum Remaining Values (MRV): Scanning for the cell with the smallest lookup-table popcount collapses the branching factor. Any naked single (
count === 1) exits the scan immediately. - Early abort at
limit = 2: Proving uniqueness does not require counting all solutions—only proving the count never reaches 2. As soon as a second completion is found, the recursion unwinds and the candidate clue removal is rolled back. On Classic 9x9, we pair this uniqueness proof with a rule-based hint engine that surfaces explanatory logical hints rather than opaque digit reveals.
No-Guess Minesweeper: Zero Pockets and Pairwise Subset Overlap
Classic Minesweeper breaks down in two places: the opening click and the late-game frontier. In No Guess Minesweeper, we solve the opening by guaranteeing a pre-opened safe zero pocket, then validate the entire remaining board with a constraint solver before play starts.
Each revealed numbered cell on the active frontier produces a constraint (Si,mi)(S_i, m_i), where SiS_i is the set of adjacent unrevealed cells and mim_i is the clue value minus adjacent flagged mines.
First, the solver exhausts single-cell rules:
- If mi=0
m_i = 0, every cell in SiS_iis safe and gets revealed. - If mi=∣Si∣
m_i = \vert{}S_i\vert{}, every cell in SiS_iis a mine and gets flagged.
Single-cell rules alone leave classic patterns like 1-2-1 or 1-2-2-1 stuck. Whenever propagation stalls, the solver compares pairs of overlapping frontier constraints (Sa,ma)(S_a, m_a) and (Sb,mb)(S_b, m_b) that share at least one unknown cell.
Let A∖BA \setminus B be the cells exclusive to SaS_a, and B∖AB \setminus A be the cells exclusive to SbS_b. Because the shared intersection Sa∩SbS_a \cap S_b holds the exact same mines for both clues, subtracting the two equations yields a tight bound on the difference sets:
- Strict subset (Sa⊂Sb
S_a \subset S_b): The remaining cells Sb∖SaS_b \setminus S_amust contain exactly mb−mam_b - m_amines. If mb−ma=0m_b - m_a = 0, every cell in Sb∖SaS_b \setminus S_ais safe. If mb−ma=∣Sb∖Sa∣m_b - m_a = \vert{}S_b \setminus S_a\vert{}, every cell in Sb∖SaS_b \setminus S_ais a mine. - General overlap: Even when neither set strictly contains the other, the difference in mine counts satisfies mb−ma≤∣B∖A∣
m_b - m_a \le \vert{}B \setminus A\vert{}. Whenever mb−ma=∣B∖A∣m_b - m_a = \vert{}B \setminus A\vert{}, the maximum possible number of mines must sit in B∖AB \setminus A(all mines) and the minimum possible number must sit in A∖BA \setminus B(all safe).
Every deduction feeds newly opened cells back into the frontier queue. If the loop terminates with unrevealed safe cells remaining—meaning the board contains an irreducible 50/50 guess or requires global mine-count tank enumeration—the board is discarded and regenerated.
Zero-Backend Daily Parity: FNV-1a + Mulberry32 over UTC
Daily puzzles usually pull an indie project into backend infrastructure: a scheduled generator, a database to store daily seeds, and an API to serve them. Moving verified generation to the client lets us eliminate the backend completely while keeping global daily parity across players and supporting a 30-day replayable daily archive.
The only requirement is bit-exact determinism across every JavaScript engine. We build a canonical UTC key (for example, 2026-11-27:nonogram:10x10), hash it into a 32-bit unsigned integer with FNV-1a, and seed Mulberry32:
JavaScript
function fnv1a32(str) { let h = 0x811c9dc5; for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 0x01000193); } return h >>> 0; } function mulberry32(seed) { let a = seed >>> 0; return function next() { a = (a + 0x6D2B79F5) >>> 0; let t = Math.imul(a ^ (a >>> 15), 1 | a); t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t; return ((t ^ (t >>> 14)) >>> 0) / 4294967296; }; } Using Math.imul and unsigned right shifts (>>>) keeps every intermediate operation inside exact 32-bit integer arithmetic, avoiding IEEE-754 precision drift. Because the candidate generator, solver verifier, and rejection loop consume only this seeded stream, two players on opposite sides of the planet derive the exact same verified board for any UTC date—with zero sign-up, zero external webfonts, and a mobile-first Apple-porcelain light UI that loads directly into the puzzle.
The broader architecture—including exact-cover verification for Shikaku, iterative coral wall sealing for Zip Game, and the probability-heatmap Hunt-and-Target AI behind Battleship Online—is documented on-site at how our solvers work. Moving proof of solvability into the browser turns puzzle fairness from a hopeful heuristic into a deterministic build invariant.
