Minesweeper Overview
The player is initially presented with a grid of undifferentiated squares. Some randomly selected squares, unknown to the player, are designated to contain mines. Typically, the size of the grid and the number of mines are set in advance by the user, either by entering the numbers or selecting from defined skill levels depending on the implementation. The grid size is often user-selectable, as a way to adjust the difficulty level.
The game is played by revealing squares of the grid, typically by clicking them with a mouse. If a square containing a mine is revealed, the player loses the game. Otherwise, a digit is revealed in the square, indicating the number of adjacent squares (typically, out of the possible eight) that contain mines. In typical implementations, if this number is zero then the square appears blank, and the surrounding squares are automatically also revealed. By using logic, the player can in many instances use this information to deduce that certain other squares are mine-free, in which case they may be safely revealed, or mine-filled, in which they can be marked as such (which, in typical implementations, is effected by right-clicking the square and indicated by a flag graphic).
In some implementations, a question mark may be placed in an unrevealed square as a marker. This has no meaning in the rules of the game, but can serve as an aid to logical deduction. Another convenience feature present in some implementations is an interface to quickly clear around a revealed square once the correct number of mines have been flagged around it. The game is won when all mine-free squares are revealed, meaning that all mines have been located.
Some implementations of Minesweeper will set up the board by never placing a mine on the first square revealed, or by arranging the board so that the solution does not require guessing. Minesweeper for versions of Windows through Vista protected the first square revealed. Minesweeper with Windows 7 also protects the first square unless the user chooses to replay a specific board.
Minesweeper can be modeled as algebra of binary variables that does not always possess a unique solution. In such cases, the player has to guess about the location of a mine. See below for an example of a case in which the player has to guess. See board puzzles with algebra of binary variables for reducing Minesweeper locally into algebra of binary variables.