Minesweeper

Minesweeper is a computer game included in Microsoft Windows. It was first included in Windows 3.1 and originally credited to Robert Donner and Curt Johnson. The current version (in Windows Vista and Windows Server 2008) was developed by Oberon Games. Earlier versions were developed by Microsoft.

Goal
The goal of the game is to uncover the mines (by flagging them with the right mouse button) without being 'destroyed' by clicking on a mine with the left mouse button. Mines are discovered by clicking on the game board revealing a grid of numbers, each number being the number of mines nearby the point clicked.

The middle mouse button may be used on a square if its status (has a mine or not) can be inferred by the surrounding flags and numbered squares.

Features
There are three sizes:


 * Beginner: 8 × 8 or 9 × 9 field with 10 mines
 * Intermediate: 16 × 16 field with 40 mines
 * Expert: 30 × 16 field with 99 mines
 * Custom: Any values from 8 × 8 or 9 × 9 to 30 × 24 field, with 10 to 667 mines [the maximum number of mines allowed for a field of size A × B is [(A − 1) × (B − 1)].

The beginner and intermediate board sizes increased from 8 × 8 to 9 × 9 in Windows 2000 and its derivatives. The reason for this change is not publicly known.

Interestingly, the density of mines is the same on the old 8 × 8 beginner field and on the 16 × 16 intermediate field (10/64 = 40/256). That 8 × 8 beginner game is still easier because it has fewer total chances of hitting a mine, and a smaller chance of having a problem that cannot be solved without guessing. The player is also much less likely to make a careless error because the game is shorter.

In 2003, Microsoft added a variation of the original Minesweeper, called Minesweeper Flags in MSN Messenger (from version 6 onwards). This game is played against an opponent, and the objective of this game is to find the mines by actually clicking on the squares where the mines are located, not by clicking the surrounding squares. The person who first uncovers 26 (out of 51) mines wins.

In Windows XP, the Minesweeper board is generated randomly before the player clicks any squares. If the player happens to click a mine square on their very first click, the mine at this square is removed and a new mine is placed in the upper left corner. If there is already a mine in the upper left corner, a new mine is placed in the first (starting in the upper left corner then proceeding left->right, top->bottom) available empty spot of the board. Once this change is made, the game proceeds as if the initial clicked square was empty. This is done to ensure that the player will not lose on their very first click.

The first clicked square is similarly immune from being a mine in the Windows Vista version of the game. Unlike the Windows XP version, however, it appears that all squares adjacent to the initial square are also immune. This guarantees the first clicked square is "blank." At this time it is not known if the Vista Minesweeper board is generated before or after the player first clicks a square in a new game.

However Windows Vista now has the ability to restart lost games, and save the progress of Windows Games like Minesweeper. Therefore it is possible to click on a mine in a restarted game, losing the game (with the option to restart again). This has also lead to people taking screenshots (or using Snipping Tool, incl with Vista) of the lost game, restarting, and completing the grid with the lost game showing where all the mines are.

Cheat mode
In versions prior to Windows Vista, the player can also cheat and have complete knowledge of all hidden mines by entering 'xyzzy' and then pressing shift before the game begins. This turns the top left pixel of the player's screen white until the mouse runs over a mine, in which case the pixel turns black.