# Minesweeper

## The Game

Minesweeper is easiest to learn by playing. For a good, if somewhat unstable, implementation, check out xmine (ie: type "xmine" in a shell). Minesweeper consists of a 2-dimensional grid of squares. Each square is originally covered; under some squares there are mines. When you uncover a square with a mine under it, you lose. When you uncover a square that doesn't have a mine under it, the game displays the number of mined squares adjacent to the current square (a number from 0 to 8). If this number is zero, the game must perform the uncover operation on all squares adjacent to it. A user flags a square to indicate that she thinks that there is a mine underneath the square. When all the squares on the board which are not mines have been uncovered, the player has won the game. A ``power-feature'' of Minesweeper that many are unaware of is the ability to check a square. When the user checks an uncovered square, and there are as many flagged squares adjacent to the checked square as there are mines (i.e., the player believes she has found all the mines adjacent to this checked square), the game performs the uncover operation on all the unflagged squares adjacent to the square. If there are more or less flagged squares adjacent to the checked square than mines, or if the player checks a square that is covered, nothing happens. This all sounds pretty complicated, but playing with it in xmine or the demo will clarify what we mean. In order to check a square in xmine, middle-click on it. Minesweeper supports varying dimensions for the board; the larger the board, the more difficult the game. The game has an 8 x 8 beginner level; a 16 x 16 intermediate level; and a 16 x 30 advanced level.