Questions tagged [minesweeper]

Minesweeper game is an abstract puzzle, quite popular as a target of sample programs in different laguages.

Rules

The object of the game is to clear an abstract minefield without detonating a mine.

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).

Popularity

The game has been written for many system platforms in use today. Versions of Minesweeper are frequently bundled with operating systems and GUIs, including Minesweeper for OS/2, Minesweeper in Windows, KMines in KDE (Unix-like OSes), Gnomine in GNOME and MineHunt in Palm OS. Apart from the bundled versions, a huge number of clones of all shapes and sizes can be found on the Internet.

Variants

Variants of the basic game generally have differently shaped mine fields in two and three dimensions, or various two-dimensional layouts, such as triangular or hexagonal grids, or possibly more than one mine per cell. For example, X11-based XBomb adds triangular and hexagonal gridsю

Complexity

In 2000, Richard Kaye published a proof that it is NP-complete to determine whether a given grid of uncovered, correctly flagged, and unknown squares, the labels of the foremost also given, has an arrangement of mines for which it is possible within the rules of the game. The argument is constructive, a method to quickly convert any Boolean circuit into such a grid that is possible if and only if the circuit is satisfiable; membership in NP is established by using the arrangement of mines as a certificate. This proof has been disputed, though.


Source: http://en.wikipedia.org/wiki/Minesweeper_(video_game)

410 questions
-4
votes
3 answers

Simple flood fill method causes StackOverFlow error

My flood fill method: public void fillNeighbours(int x, int y) { for(int i = -1; i < 2; i++) { for(int j = -1; j < 2; j++) { try { visible[x+i][y+j] = true; if(num[x+i][y+j] == 0) { …
Matrx007
  • 25
  • 7
-4
votes
1 answer

How to solve error process returned -1073741819 in C

This is going to be a Minesweeper but is not finished yet. For now, the program should ask you for the size of the array and the number of mines. Then, it shows the hidden board (the one with numbers and 'X' as mines). That's all. The problem is…
-4
votes
2 answers

Minesweeper C++

I've written the minesweeper game for C++, and the core game is complete. There are three things I need to ask. Currently, my mines are placed at random positions.. I was wondering if this is true for the actual game? Are the mines random or is…
Cerberus
  • 101
  • 3
-6
votes
1 answer

Minesweeper flags java

I'm pretty new in programming, but i need to program the game Minesweeper. basically the game is running, but there are some parts that wont work at all. The first problem are the flags. My Minesweeper is able to set flag by right clicking on a…
1 2 3
27
28