Under the Hood

How the Minesweeper AI Solver Works: Constraints and Probability

Published September 12, 2026 · LK Forge · numbers from a re-runnable, seeded benchmark
80.6%
of Beginner boards cleared by pure logic
3.9%
on Expert — guessing becomes the rule
exact
mine odds when logic runs out
0
servers — runs in your browser

The hint on LK Forge Minesweeper is not a hunch and not a language model. It is a real constraint-satisfaction solver that reads the visible board and, wherever the numbers allow, proves which cells are safe. Here is how it thinks.

Every number is a constraint

Each revealed number is a fact about its hidden neighbours: a 2 means exactly 2 mines among these hidden cells. The solver writes every number down that way and then combines the constraints. Often two overlapping numbers settle each other — the classic 1-2-1 pattern along an edge forces mines under the 1s and clears the cell under the 2 — and the solver knows those subset relationships, so it can chase deductions a human would.

// each revealed number becomes: exactly N mines among {hidden neighbours}
const constraints = [
  { cells: ['b2','c2'],        mines: 1 },   // the "1"
  { cells: ['b2','c2','d2'],   mines: 2 },   // the "2"
];
// subtract the subset: {d2} must hold 2 − 1 = 1 mine  → d2 is a mine,
// and the "1" now pins its own mine, clearing the rest.

A cell that is a mine in every arrangement consistent with the numbers gets flagged; a cell that is a mine in none is proven safe. When the solver reports a safe cell, it is not playing the odds — it is certain, and it even names the rule it used.

When logic runs out, count the worlds

Sometimes no proof exists — the numbers simply do not pin down a safe cell. The solver does not throw up its hands. It enumerates every mine arrangement consistent with the visible board and, for each hidden cell, counts the fraction of those arrangements in which it holds a mine. That fraction is the exact mine probability, and it recommends the smallest one. No algorithm can make an unforced guess safe — but this makes the least dangerous guess available.

How often can pure logic carry you?

We measured it over tens of thousands of first-click-safe boards with this exact solver. The share of games it clears by deduction alone collapses with mine density: comfortable on Beginner, a coin toss on Intermediate, and nearly hopeless on Expert, where roughly 96% of games reach a position that forces a guess.

0 25 50 75 100 80.6% 53.2% 3.9% Beginner Intermediate Expert Share of boards clearable by pure deduction (no guess) → lkforge.com

No-guess clear rate over 20,000 Beginner, 8,000 Intermediate and 4,000 Expert first-click-safe boards. Full method — and win rates and guess counts — in How Often You Must Guess in Minesweeper.

No-Guess mode is the solver in reverse. Before you ever see the grid, the same engine checks that a board is clearable by pure deduction from the first click — and only then serves it. So you never lose to a coin flip you had no way to win.

That is the whole solver: turn numbers into constraints, prove what can be proven, and when nothing can, count every consistent world to get the exact odds. Want the full study behind these figures? Read How Often You Must Guess in Minesweeper, or the human-side view in Minesweeper Patterns Explained.

FAQ

How does the Minesweeper solver decide which cells are safe?

The solver treats every revealed number as a constraint — 'exactly N mines among these hidden neighbours' — and combines them, including subset patterns like 1-2-1. A cell that is a mine in every consistent arrangement is flagged; a cell that is a mine in none is proven safe. When a proof exists, the answer is certain, not a guess.

What does the solver do when logic can't decide?

The solver enumerates every mine arrangement consistent with the visible numbers and counts, for each hidden cell, the fraction of arrangements in which it is a mine. That gives an exact mine probability, and it recommends clicking the lowest one. It cannot make an unforced guess safe, but it makes the least bad one.

Do you always have to guess in Minesweeper?

Whether you have to guess depends heavily on difficulty. Measured over tens of thousands of first-click-safe boards, the solver cleared 80.6% of Beginner boards by pure logic, 53.2% of Intermediate and just 3.9% of Expert — so on Expert, roughly 96% of games force a guess at some point. Denser boards leave fewer provably safe cells.

What is No-Guess mode?

No-Guess mode generates only boards the same solver has verified are clearable by pure deduction from the first click, so you never lose to a coin flip. It is the solver run in reverse — as a board filter — before you ever see the grid. Ask for a hint on one of these boards and a provably safe move always exists.

Let the solver explain your board.

Play Minesweeper →