Ivars Peterson's MathTrek

May 3, 1999

# Minesweeper Logic

The game Minesweeper is one of the more insidious time wasters available to users of Windows-based computers. It's easy to become addicted to this seemingly simple solitaire game, in which strategy, logic, and luck add up to a potent, mind-teasing mixture.

In the basic version of the game, the player faces a gray landscape of 64 blank squares in an eight-by-eight grid. The object is to locate 10 randomly placed "land mines" hidden among the playing field's squares, working as quickly as possible without detonating any of them. Larger boards are also available.

To uncover a square, the player clicks on it with the left mouse button. If the square harbors a mine, the player loses. If instead a number (from 1 to 8) appears on the square, it specifies how many mines are present in the eight squares surrounding the numbered square. It's clear, for example, that finding a square numbered 8 means that all eight adjacent squares contain mines. If the square remains blank, there are no mines in the surrounding squares.

To mark a square suspected of containing a mine, the player clicks on it with the right mouse button, putting a little flag on the square.

The first few moves require one or more wild, potentially fatal guesses. Given that uncertainty, is it better to start in a corner, on the side, or in the middle? That choice depends on the sorts of things that can happen on subsequent moves, which are not the same for every starting position. Experts recommend beginning somewhere in the middle.

If you survive the initial phase, you can then rely on logic to carry you the rest of the way--most of the time. There are a few situations in which you may be forced to guess a mine's location to complete a game.

It doesn't take long to develop strategies for playing and beating the game. In general, clearing a board rapidly requires a form of pattern recognition. For example, if an uncovered square is labeled 1, and there is only one covered square touching it, that covered square must be a mine.

Finding a square with the number 1 next to a suspected mine means that all other unknown squares surrounding the numbered square can be safely uncovered (assuming you marked the mine correctly). In fact, if you have found all the mines around a given numbered square, you can uncover the remaining squares by clicking the numbered square with the left and right mouse buttons simultaneously.

You can also take advantage of a little quirk. In some versions of Minesweeper, Microsoft programmers designed the game so that the first click never hits a mine. If the square originally contained a mine, the computer moves it to the top left-hand corner of the board or to the first available square to its right.

Mathematicians Patti Frazer Lock of St. Lawrence University in Canton, N.Y., and Allan A. Struthers of Michigan Technological University in Houghton have taken the business of developing Minesweeper strategies one step further. Earlier this year at the Joint Mathematics Meetings in San Antonio, Lock described how she uses the game to introduce students to formal mathematical proofs.

In Lock's sophomore courses, students play a few games, then try to evaluate various types of positions to determine which squares are definitely safe and which ones are definitely mined. The exercise gives them a sense of what, given the rules and the evidence, to conjecture, then prove or test.

"Putting a flag on a square is a theorem--you know there's a bomb there," Struthers explains.

Students end up learning reasoning techniques, such as proof by contradiction or the role of counterexamples, that not only apply to Minesweeper but also are useful for proving theorems later in their mathematics courses.