Minesweeper

Classic Minesweeper with selectable beginner/intermediate boards.

Open tool

Overview

Minesweeper is the classic logic puzzle where you reveal cells on a grid while avoiding hidden mines. Each safe cell shows the count of mines in its eight neighbours; cells with zero adjacent mines cascade open. Right-click to flag a suspected mine. Reveal every non-mine cell and you win; click a mine and you lose.

This implementation offers Beginner (9x9, 10 mines) and Intermediate (16x16, 40 mines) boards, plus a timer and flag counter. It's a quick puzzle when you have a few minutes and a serious test of probabilistic reasoning when the board gets close to full.

How it works

When the board is initialised, mines are placed by sampling cells uniformly without replacement until the target count is met. The "first click is always safe" rule is implemented by deferring mine placement until your first click, then excluding that cell (and often its neighbours) from the mine pool.

Each non-mine cell stores the count of mines in its eight neighbours, computed in one O(n) pass after placement. Clicking a cell reveals it; if the count is zero, the engine flood-fills outward, revealing every connected zero-cell and the single ring of numbered cells that borders them. This is what produces the satisfying "cascade" of opens on a good early click.

Examples

  • A "1" at the edge with one unrevealed neighbour means that neighbour is the mine — flag it.
  • A "1" adjacent to a flagged mine has its count "satisfied"; all other unflagged neighbours are safe.
  • Two adjacent "1"s in a corner of the board commonly form the simplest deduction pattern: one of the two cells is the mine.
  • The "1-2-1" pattern along a wall is a famous mid-game deduction: the cells under the 1s are safe, the cell under the 2 is the mine.

FAQ

Is the first click guaranteed safe?
Yes. Mines are placed after the first click so it cannot detonate.

What does the count actually count?
The number of mines among the eight neighbours (including diagonals) of the cell.

Why does the game open multiple cells when I click one?
If the clicked cell has zero adjacent mines, the engine cascades outward to expose the connected region.

Is right-click required?
Right-click flags a cell; left-click reveals. You can win without flagging, but flags help avoid mistakes.

Are some boards unwinnable from the first click?
Strict Minesweeper allows positions where you must guess. The "no guessing" generators avoid such boards by re-rolling layouts.

Try Minesweeper

An unhandled error has occurred. Reload ×