3.4 KiB
Minesweeper
Minesweeper is a simple but entertaining singleplayer puzzle game whose objective is to deduce the locations of all mines hidden in a square grid from certain clues and mark all the mines without detonating any of them. Commonly the game is treated as a minigame but can be taken to much higher level for example with speedrunning or by expanding the concept to create a more complex game. Minesweeper falls under the kind of games highly appreciated by LRS perspective -- it's very simple to program and learn but still highly fun to play, it's mathematically interesting and can in theory be played even without a computer (if someone else prepares you the board). Current form of the game seems to have evolved from a 1983 game called Mined-Out.
_ _ _ _ _ _ _ _ _
|_|_|_|_|_|_|_|_|_|
|_|_|#|_|_|_|_|_|_|
|_|_|3 2 1 1|#|2|_|
|_|#|1 . . 1 1 2|_|
|1 1 1 . . . . 1|_|
|. . . . . . . 1 1|
|. . . . . . . . .|
|. . . 1 2 2 1 . .|
|._._._1|_|_|1_._.|
In progress game.
The rules are following: initially a W times H grid is created and N mines are placed on random squares (size of board and number of mines can affect difficulty). All squares are obscured so that the player doesn't see where the mines are. The player can dig on any square by clicking it -- if he clicks on a mine square, it detonates and he loses (here all mines are revealed to him). Implementations typically make it so that the first click can never land on a mine (if it does, the mine is relocated). If the click is on empty square, then this square as well as all other mine-free squares reachable from this square (by walking in 4 principal directions) are revealed as mine-free. All revealed squares have a clue number which says the number of mines in its immediate 8 neighbor squares -- except for squares with clue number 0, all squares have their clue number written on them (often each number has its own color to help with pattern recognition). These clues help the player deduce where the mines are. Player can mark any hidden square with a mine symbol -- once all mine-free squares are revealed, the game is won.
The game requires deductive thinking -- at least initially when one is learning, later on it turns almost entirely into a pattern recognition game. The patterns are very local and there isn't that many of them, so one learn them quickly. The game however DOES involve a bit of chance and luck, situations may arise where taking a guess is necessary, but these are relatively few and risk can be minimized with clever deduction.
Some patterns can be seen in the above image. For example a square with clue number N which has N neighbors mean that all its neighbors have mines -- this is often seen e.g. with 1s near corners (seen in the picture). We can also see at the bottom of the board that the two squares will both clearly contain mines. A more intricate pattern is seen near the square with number 3 -- the mine above it was deduced from the number 2 at its right and the number 1 next to the 2: according to the 2 square there have to be 2 mines somewhere in the 3 squares above it, but it's impossible for one mine to be above the 2 with the other being top-right from the 2 as that would place 2 mines in the area of the square with clue number 1, therefore one of the mines has to be top-left from the square with number 2 (above the square with 3).