Minesweeper (computer game)

From Wikipedia, the free encyclopedia

The game begins when the user clicks on a blank square.
The game begins when the user clicks on a blank square.
A finished game
A finished game

Minesweeper is a single-player computer game. The object of the game is to clear an abstract minefield without detonating a mine. The game has been rewritten for nearly every system platform in use today. The most well-known version is Minesweeper for the Windows platform, which comes bundled with versions of the operating system from 3.1 and on.

Contents

[edit] Overview

When the game is started, the player is presented with a grid of blank squares. The size of the grid is dependent on the skill level chosen by the player, with higher skill levels having larger grids. If the player clicks on a square without a mine, a digit is revealed in that square, the digit indicating the number of adjacent squares (typically, out of the possible 8) which contain mines. By using logic, players can in many instances use this information to deduce that certain other squares are mine-free (or mine-filled), and proceed to click on additional squares to clear them or mark them with flag graphics to indicate the presence of a mine.

The player can place a flag graphic on any square believed to contain a mine by right-clicking on the square. Right-clicking on a square that is flagged will sometimes, according to settings, change the flag graphic into a question mark to indicate that the square may or may not contain a mine. Right-clicking on a square marked with a question mark will set the square back to its original state. Squares marked with a flag cannot be cleared by left-clicking on them, though question marks can be cleared as easily as normal squares. The third question mark state is often deemed unnecessary and can be disabled so that right clicking on a flagged mine will set it back to its original state right away so mines flagged in error can be corrected with one right-click instead of two.

In some versions of the game, middle-clicking (or clicking the left and right buttons at the same time) on a number having as many adjacent flags as the value of the number reveals all the unmarked squares neighboring the number; however, one forfeits the game should the flags be placed in error. This method is a very useful tool when trying to beat a good score. Some of those implementations also allow the player to move the mouse with the right mouse-button held down after marking mines; the player can then left-click on multiple numbered squares while dragging with the right mouse-button, in order to clear large areas in a short time. As an alternative to clicking both buttons at the same time players can also middle-click or shift-click on fully-flagged numbers.

Some implementations of Minesweeper will set up the board in favor of the player by never placing a mine on the first square clicked, or by arranging the board so that the solution does not require guessing.

[edit] History

The basic gameplay style became a popular but minor part of the puzzle game genre during the 1980s, with such titles as Mined-Out (Quicksilva, 1983), and Yomp (Virgin Interactive, 1983). Cube was further succeeded by Relentless Logic (or RLogic for short), by Conway, Hong, and Smith, which was available for MS-DOS as early as 1985. In RLogic, the player is a private in the United States Marine Corps, delivering an important message to the U.S. Command Center. RLogic is more similar to Minesweeper than to Cube in concept, but a number of differences exist:

  • In RLogic, the player must navigate through the minefield, from the top left corner to the bottom right corner (the Command Center).
  • It is not necessary to clear all non-mine squares. Also, there is no mechanism for marking mines or counting the number of mines found.
  • The number of steps taken is counted. Although no high score functionality is included, players could attempt to beat their personal best score for a given number of mines.
  • Unlike Minesweeper, the size of the minefield is fixed. However, the player may still specify the number of mines.
  • Because the player must navigate through the minefield, it is sometimes impossible to win — namely, when the mines block all possible paths.

The gameplay mechanics of minesweeper have evolved to become encompassed in a variety of further software titles; one notable occurrence of this is the mini-game Vinesweeper implemented into the MMORPG Runescape. In this particular venture (written by Jagex developer Danny J), the Minesweeper gameplay is given a large multiplayer aspect and the 'game board' adopts a continually resetting timer. This allows for a never-ending game of Minesweeper where the skill is awarded by the merit of points rather than 'game completion'.

[edit] Game analysis

[edit] Patterns and solving

There are many patterns of numbered squares that may arise during a game that can be recognized as allowing only one possible configuration of mines in their vicinity. In the interest of finishing quickly, it is often easiest to process the known patterns first, and continue on with the uncertain parts later. There are a few broad methods for solving problems in minesweeper games without guessing.

[edit] Single-square analysis

Example case 2
Image:Minesweeper 0.gif Image:Minesweeper 3.gif Image:Minesweeper flag.gif Image:Minesweeper unopened square.gif
Image:Minesweeper 0.gif Image:Minesweeper a.gif Image:Minesweeper b.gif Image:Minesweeper unopened square.gif
Image:Minesweeper 1.gif Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif
a and b must be mines, because the 3 is missing 2 mines, and the only squares that can provide with those mines are a and b.
Example case 1
Image:Minesweeper flag.gif Image:Minesweeper 3.gif Image:Minesweeper flag.gif Image:Minesweeper unopened square.gif
Image:Minesweeper a.gif Image:Minesweeper b.gif Image:Minesweeper flag.gif Image:Minesweeper unopened square.gif
Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif
a and b are safe to open, because the 3 is already satisfied with 3 mines.

There are two special cases that are of extra interest when solving a board that can be solved using analysis of only one square and its surrounding squares[1]

  • If the amount of unopened squares surrounding a number is equal to that number, those unopened squares must all be mines.
  • If, for a number on the board, the amount of mines adjacent represented by that number can all be found, then every other square that is not known to be a mine must be safe.

[edit] Multiple square analysis

To solve more complex puzzles, one needs to consider more than one square at a time. Some strategies that involve considering more than one number at a time:

  • If you have two adjacent numbers, the difference between those numbers is equal to the difference in the amount of mines for the 3 squares adjacent to each that are not adjacent to the other number. For example: if these numbers differ by 3, all of the adjacent squares to the higher number not shared by the other are mines, and all the opposite ones are safe.
  • In a similar method, sometimes it can be known that there are a certain number of mines in a certain number of squares (without necessarily knowing which are the mines and which are safe) and you can often utilise this information to find out information about other squares.

One method that are commonly used in minesweeper AIs is to consider the board as a constraint satisfaction problem [2] [3].

The variables, or unknowns, in minesweeper are the unopened squares, and the constraints are the adjacent squares that are opened. The algorithm consists of trying every combination of mines that satisfies all the numbers in the adjacent squares, and making a conclusion from there. For large puzzles, this is a time-consuming process for a computer, but expert minesweepers might be able to quickly see which squares need this procedure, and where one might expect it to succeed. The two rules above are such special cases.

Example
Image:Minesweeper 0.gif Image:Minesweeper 1.gif Image:Minesweeper a.gif Image:Minesweeper unopened square.gif
Image:Minesweeper 1.gif Image:Minesweeper 2.gif Image:Minesweeper b.gif Image:Minesweeper unopened square.gif
Image:Minesweeper c.gif Image:Minesweeper d.gif Image:Minesweeper e.gif Image:Minesweeper unopened square.gif
Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif Image:Minesweeper unopened square.gif

Example: A corner square and the 3 adjacent squares have been opened, and the numbers given revealed. The letters here are unopened squares and they are the variables.

Blindly trying every combination gives the 4 valid configurations (out of 25), namely {a,b,c,d,e} = {1,0,1,0,0}, {0,1,1,0,0}, {1,0,0,1,0} and {0,1,0,1,0}, where 1 represents a mine.

The only common number in all these configurations is that the variable e is never a mine. The conclusion is that in all possible valid configurations, e is safe, and one can safely open that square. Analogously, if a square is marked as mine in every valid combination, then the square must be a mine.

One can also think of this as a system of equations, where the variables must be in {0,1}. In the above example, the constraints gives that a+b=1, c+d=1 and a+b+c+d+e=2. The third equation can be reduced to 1+1+e=2 and hence the square e must be safe. This strategy is more similar to the human approach, but is harder to implement as a computer program.

[edit] Final analysis

Used at the end of a game, this can be used to clear a square when all other squares on the board are either safe or can be shown to be mines. Often these final squares are on walls or in corners.

In some versions of the game the number of mines on the field is known. Near the end when almost all the tiles are lifted, knowing the number of mines remaining can give some insight to otherwise unresolvable patterns.

[edit] Elements of guesswork

In most implementations of Minesweeper, it is possible for a grid to be generated which cannot be solved without an element of guessing. For instance, in the following situation:

Example
Image:Minesweeper 1.gif Image:Minesweeper 2.gif Image:Minesweeper 3.gif Image:Minesweeper 2.gif Image:Minesweeper 1.gif
Image:Minesweeper 1.gif Image:Minesweeper flag.gif Image:Minesweeper flag.gif Image:Minesweeper flag.gif Image:Minesweeper 1.gif
Image:Minesweeper 1.gif Image:Minesweeper 3.gif Image:Minesweeper a.gif Image:Minesweeper 3.gif Image:Minesweeper 1.gif
Image:Minesweeper 0.gif Image:Minesweeper 1.gif Image:Minesweeper b.gif Image:Minesweeper 1.gif Image:Minesweeper 0.gif

The player must guess which of Image:Minesweeper a.gif and Image:Minesweeper b.gif that is a mine.

The constraint satisfaction problem above might help a little to estimate the likelihood that a square is a mine; list all the valid combinations and count how many times each square is occupied by a mine. If the density of mines is known (or estimated during the game), the player can pick the square that is least likely to contain a mine.

Another apparent instance of required guessing is when an unclicked square is completely surrounded by either mines, or a combination of mines and the perimeter of the game window (the latter being much more common). In this case, since no numbers touch the unclicked square, a player has no information about the likelihood of the unclicked square being a mine. However, there is still a good strategy when facing this situation that will allow the player to avoid simple guessing: simply play the rest of the game and ignore this square. If the spot is in fact a mine, it will be automatically flagged when all other squares in the game window have been either clicked or flagged by the player. If the spot is not a mine, it will not be automatically flagged, and the player will be able to safely click it in the knowledge that it is not a mine. This only happens in some implementations of the game.[citation needed]

Simon Tatham's variant, on its default settings, only generates puzzles that can be solved without guesswork[4]. The situation of squares surrounded by mines remains, but they will either all be mines or all be clear, and this becomes obvious at the end of the game. A few other variants eliminate guesswork by giving away the answer when a guess is required, or by allowing any guess to be correct when this is the case.[citation needed]

[edit] Probability analysis

If "playing Minesweeper perfectly" means finding a strategy that ensures the best probability of solving a random board, then there is more to playing perfectly than just choosing squares with lowest mines probabilities. Consider the following situation:

Example
Image:Minesweeper 2.gif Image:Minesweeper flag.gif Image:Minesweeper flag.gif Image:Minesweeper flag.gif Image:Minesweeper 3.gif Image:Minesweeper 1.gif
Image:Minesweeper 2.gif Image:Minesweeper flag.gif Image:Minesweeper a.gif Image:Minesweeper flag.gif Image:Minesweeper 5.gif Image:Minesweeper flag.gif
Image:Minesweeper 2.gif Image:Minesweeper 4.gif Image:Minesweeper b.gif Image:Minesweeper d.gif Image:Minesweeper e.gif Image:Minesweeper flag.gif
Image:Minesweeper 2.gif Image:Minesweeper flag.gif Image:Minesweeper c.gif Image:Minesweeper flag.gif Image:Minesweeper 5.gif Image:Minesweeper flag.gif
Image:Minesweeper 2.gif Image:Minesweeper flag.gif Image:Minesweeper flag.gif Image:Minesweeper flag.gif Image:Minesweeper 3.gif Image:Minesweeper 1.gif

There is 2/3 probability of a mine on a, b, or c and 1/2 probability of mine on d or e; this can be derived by computing the six possibilities of mine placement on a...e. But playing d or e will give the player no useful information: if the player does not trigger a mine, he or she will see a 6 appear under e, or a 5 appear under d. Overall, playing d or e will let the player solve the area in only 1 of the 6 possible cases. If he or she plays a (or b or c) and he or she does not step on a mine, he or she will immediately know whether there is a mine on d or not; overall the player would solve the area in 2 of the 6 possible cases. So the moves a, b, or c, with the highest immediate danger, turn out to be the best in the long run.

This is a specific example of a more general principle that applies when prioritising squares: an unknown square should not be clicked on if more information may be gained by first clicking on an adjacent square; conversely, if there is no way to gain more information about a square, then a guess is inevitable and it should be clicked on to provide more information about the rest of the area.

[edit] NP-completeness

In 2000, Kaye published a proof that it is NP-complete to determine whether a position in a Minesweeper game is consistent with some placement of mines. [5] Minesweeper is now mentioned in the Clay Mathematics Institute's unofficial description of the P versus NP problem. [6]

[edit] Measuring board difficulty

Beginner board with a 3BV of 25
Beginner board with a 3BV of 25

The difficulty of a given minesweeper board is often measured using the 3BV measure (abbreviated from Bechtel's Board Benchmark Value).

[edit] Method

The 3BV of a board names the minimum number of left clicks required to open up all squares without a mine of a Minesweeper field.

  • Each opening of a board counts as 1 3BV (white dots on the pictures).
  • Each square without a mine but a number which is not a border (white lines) of an opening counts as 1 3BV (green dots on the pictures).

The sum of the 3BV is the 3BV of the whole board.

[edit] 3BV/s

3BV/s stands for 3BV per second.

  • Formula: 3BV/s = 3BV ⁄ (time−1)

The subtraction of one from the time is required in some implementations due to the fact that minesweeper begins with one second on the clock (as opposed to zero) and as such the time shown is always one second greater than the actual time taken. Thus, for example, if a Minesweeper board with a 3BV of 16 is finished with the clock displaying 9 seconds, the 3BV/s is 16⁄(9−1) = 2.

Because the time that is needed to finish a Minesweeper board depends highly on the difficulty of the board, it may not be the best way to compare records. 3BV/s on the other hand does consider the difficulty of the Minesweeper board as well as the time needed to finish it. Among the best Minesweeper players, 3BV/s records are not nearly as important as time records, but they give a picture of how fast someone can play with regard to mouse-handling.

If flags are marked, it is possible to require fewer clicks than the 3BV of the respective board. Using only left clicks is called non-flagging (nf) whereas marking mines with right-clicks is called flagging-style.

[edit] Implementations

There are several implementations of the game in its classic form. The game is frequently bundled with operating systems and GUIs, including minesweeper in Windows, KMines in KDE(Unix-like OSes) and Gnomine in GNOME. Apart from the bundled versions, a huge number of clones of all shapes and sizes can be found on the Internet. This is because it is relatively easy to write a basic minesweeper game.

Variants of the basic game generally have differently shaped minefields in two and three dimensions, or various 2D layouts (such as triangular or hexagonal grids). For example, X11-based XBomb adds triangular and hexagonal grids, and Professional Minesweeper for Windows includes these and many others.

[edit] Best times

The minesweeper community has compiled a world ranking of the fastest games submitted by players. In order to get on that list, records on beginner, intermediate and expert must add up to no more than 99 seconds. Since April 2000 the ranking has been hosted at Authoritative Minesweeper, although from 2004-2006 the ranking at Planet Minesweeper performed this function as well. [7]

The current world records are:

  • 37 seconds on expert by Dion Tiu
  • 10 seconds on intermediate tied with Dion Tiu, Roman Gammel, Manuel Heider, Kamil Muranski and Matt McGinley (and disputed scores of 9 and 10 by Jake Warner)
  • 1 second on beginner - depending on the arrangement of mines, rare levels of "beginner" difficulty can be completed with a single click (1 click games are not accepted for ranking purposes)

Theoretically games can be solved with one click, but this is not the case as the Windows version of minesweeper uses a finite set of cycling boards, while clones accepted for rankings impose 3BV[8] limits.

[edit] Criticism

In 2001, the Italian "International Campaign to Ban Winmine" voiced strong concern over the game, contending that it is an "offence against the victims of the mines" and those who risk their lives to clear them. They created their own "Winflower" game, and lobbied Microsoft to use it in place of Minesweeper in Windows XP.[9]

[edit] See also

[edit] References

[edit] External links

[edit] Minesweeper in science