The worst moment in any minesweeper-style game is the end-of-board coin flip: two hidden cells, one mine, and nothing on the board that tells you which. You did everything right and the game still asks you to guess.

Mole Sweep, the daily mole-hunting puzzle on JumpBud, removes that moment. Every Daily Field is a 16×16 meadow with 40 moles, everyone gets the same board on the same date, and before a board ships the game proves it can be cleared from the center opening using logic alone. The whole thing runs in the browser: no server, no puzzle database. This post walks through the generator, the solver that gates it, and some numbers from running it over a full year of dates.

Generate, then try to solve it

The approach is rejection sampling. Place moles at random, keep the 3×3 around the starting cell clear so the first dig always opens an area, then hand the board to a solver that only knows rules a careful human uses. If the solver clears it, ship it. If it gets stuck, throw the board away and draw again.

function generate(R, C, M, seed, start, maxMs = 1500) { const rng = mulberry(seed); const N = R * C, nb = neighbors(R, C); const banned = new Set([start, ...nb[start]]); // first dig is always a zero const t0 = Date.now(); let tries = 0; while (true) { tries++; const mines = new Uint8Array(N); const pool = []; for (let i = 0; i < N; i++) if (!banned.has(i)) pool.push(i); for (let k = 0; k < M; k++) { // partial Fisher-Yates const p = k + Math.floor(rng() * (pool.length - k)); [pool[k], pool[p]] = [pool[p], pool[k]]; mines[pool[k]] = 1; } const num = counts(mines, nb); if (solveFrom(mines, num, nb, new Uint8Array(N), M, start)) return {mines, num, nb, tries, verified: true}; if (Date.now() - t0 > maxMs) return {mines, num, nb, tries, verified: false}; } } 

The daily seed is just the date: 20261206 * 31 + 7 goes into a small mulberry32 PRNG. Because the RNG is deterministic and the loop takes the first board that passes, every device lands on the same board, however fast or slow it is. For the Daily Field the time limit is Infinity, so a slow phone never falls back to an unchecked board. Practice fields keep a 1.5 s cap so the first tap never hangs.

The solver: three rules, nothing clever

The solver keeps a known array (0 hidden, 1 dug, 2 flagged) and loops until it stops making progress. Each pass tries the cheapest rule first and only moves on when that rule finds nothing.

Rule 1: single number. For each revealed number, count its flagged neighbours and hidden neighbours. If the flags already match the number, every hidden neighbour is safe. If the hidden cells are exactly what is missing, they are all moles.

const need = num[i] - flagged; if (need === 0) unk.forEach(j => safe.add(j)); else if (need === unk.length) unk.forEach(j => mole.add(j)); else cons.push({cells: unk, need, set: new Set(unk)}); 

Rule 2: overlapping numbers. Leftover constraints are compared pairwise when they share a cell. If A's hidden cells are a subset of B's, then B's extra cells hold exactly B.need - A.need moles, so they are either all safe (difference 0) or all moles (difference equals their count). There is also the classic 1-2 pattern: if A needs more moles than its private cells can hold and the overlap is forced, A's private cells are moles and B's private cells are safe.

Rule 3: mole count. When nothing else works, use the total. If every mole is flagged, the rest of the meadow is safe. If the hidden cells equal the moles left, flag them all.

Whatever the solver can't settle with these three rules, the generator rejects. There's no backtracking search and no probability, so if the solver can see it, a player who knows the same three patterns can see it too.

Numbers from a year of dates

I ran the real generate() from the game file in Node over every date in 2027, plus 2,000 random layouts per difficulty with a center start:

Field Size / moles Random layouts that pass Check time Median tries
Easy 9×9 / 10 83.8% 0.03 ms 1
Medium / Daily 16×16 / 40 62.0% 0.14 ms 1
Hard 30×16 / 99 10.3% 0.49 ms 7

For the 365 Daily Fields: on average 1.6 attempts per board (worst day: 7), median generation time 0.26 ms, max 9.8 ms. Hard is the only level where rejection gets expensive, and even there 200 seeds never came close to the 1.5 s cap (slowest: 19 ms).

Two findings surprised me:

  • Rejected boards fail late. When the solver gives up, it has typically already dug 96–98% of the safe cells on Easy and Medium (90% on Hard). That matches what players complain about: the guess is almost always in the last corner, after five minutes of good play.
  • Rule 2 does real work. Rule 1 alone clears only 158 of the 365 daily boards. Adding the overlap rule brings it to 359, and the mole count finishes the last 6. A daily built only on Rule 1 would be either much easier or impossible to make no-guess.

The same solver powers Hint

Since the solver exists anyway, the Hint button reuses it. It runs the same loop on the player's current view, with stopAtFirst set, takes the provably safe cells, and digs the one closest to the cursor. If the player has placed a wrong flag, Hint removes that first, because a wrong flag makes every later deduction unreliable. On a verified board, a hint is never a lucky reveal: it's a cell the numbers on screen already prove.

Takeaways

  • For logic puzzles, "generate randomly, verify with a human-level solver" is often simpler than building puzzles constructively, as long as acceptance rates stay reasonable. Measure them per difficulty.
  • Decide what "human-level" means and code exactly that. Here it's three rules. A stronger solver would accept boards that players can't actually read.
  • Seeded RNG plus "first verified board wins" gives you a server-free daily that's identical on every device.

You can play today's field (and the last 7 days) here: Mole Sweep, a daily no-guess logic puzzle on JumpBud.