Skip to content
Vuk Cvetković
GamesBuilt:

Minesweeper

Open every cell that is not a mine. A number says how many of the eight cells around it are mined, and everything else is worked out from there. Three boards, the sizes the original shipped with, and a first click that can never lose.

Board
Mines0
Time0:00
Best-

Cleared

Every cell that was not a mine is open.

Mine

The field is shown as it was. A flag on a clear cell is marked, which is usually where the reasoning went wrong.

Press to open, right-click or F to flag, a long press on a phone. A finished number opens the rest of its ring on a press or the middle button.

How to play

  1. The first click is safe

    The mines are laid after it, away from wherever you pressed, so the opening move cannot lose and always breaks into open ground. Start anywhere.

  2. A number counts its neighbours

    It is how many of the eight cells touching it hold a mine. A cell with nothing near it opens the whole region around it in one press.

  3. Flag what you have worked out

    Right-click on a desktop, F on a keyboard, a long press on a phone. A long press only ever plants one, so a slow finger cannot take back what it just put down - flag mode is what removes one, and it is what you want for a whole run of them anyway. The counter shows mines less flags.

  4. Press a number you have finished

    Once a number has as many flags around it as it says, pressing it opens the rest of its ring at once, and so does the middle button. Hold the button down first and the cells it would open go down with it, so you can see the eight before you commit. That is where the speed in this game is, and most players never find it.

How it is built

No canvas and no game library, and unlike 2048 nothing slides either. There is no loop and nothing in flight: a cell is a button, it changes state or it does not, and the whole board is four hundred and eighty of them at the expert size. What it costs to run is a class on an element.

The mines are laid on the first press rather than at the start, clear of the cell that was pressed and the eight touching it. A field dealt in advance has to either let the opening move lose, which is a coin toss rather than a game, or deal again until it does not, which quietly bends the odds everywhere else. Laying them late gets an honest field and a first move that always opens into a region.

Opening a region is a queue rather than a recursion, which a phone is entitled to refuse once the fill runs four hundred deep, and the queue hands the animation its timing for free: the ring a cell was found on is how far it is from the press, so each one waits that many steps before it opens. The fill arrives as something spreading outwards instead of the board changing all at once, and it costs one custom property and a delay.

The board is a real grid: rows, cells, a row and column count, and one cell in the tab order at a time so the arrow keys walk it rather than the Tab key. 2048 has to be hidden from a screen reader and described through a live region, because sixteen tiles that rewrite themselves on every keypress cannot be read. A minefield is a table that sits still and waits, which is exactly what a grid is for.

Esc