# Is it possible to hit a mine on first click?

Is it possible for some unlucky guy to hit a mine when they click the first square randomly?

• Tangentially related on Puzzling.SE: Is it always safe to start on the lower left-hand corner? Aug 3, 2017 at 11:01
• @Pharap Solving it should be pretty trivial. If you keep a list of spaces without mines, pick one at random and swap its contents with whatever square the user first clicked on. Aug 4, 2017 at 10:47
• @jamesdlin Oh I know, it's not a hard problem, my solution was going to be different from the canonical solution though. Aug 4, 2017 at 12:12
• I did a minesweeper game during my first semester in college and generating the map after first click was a very trivial thing. Aug 6, 2017 at 8:08
• This one is always solvable, and doesn't boom! at first click. May 7, 2021 at 5:25

It is impossible to click a mine on the first click, at least in Windows 98. If a mine is under the first clicked tile, it is moved to the upper-left corner, if the upper left corner is occupied, the mine moves to the right of the corner tile. It does not appear the behavior has changed since then.

Source

• On newer versions (Win 7+) it should be possible to hit a mine with the first click.
– dly
Aug 2, 2017 at 6:40
• What if all four corners are occupied? Aug 2, 2017 at 8:34
• @SunQingyao It's not trying the right corner, it's trying the left corner +1 (e.g. one step right). If the top row is full, it tries the next row. This could only fail if the entire board were full of mines, which I believe is not allowed in the game configuration. Aug 2, 2017 at 9:46
• @dly That's only possible if you restart the same game, keeping the mines in the same places. Under normal conditions, Win7 Minesweeper doesn't generate the board until after the first click, and it also ensures that the first click is always a 0. Aug 2, 2017 at 10:30
• I have tried this on this link: copy.sh/v86/?profile=windows98 and it seems it is correct. There's no way to lose on the first click and I have deleted the other answer I had provided before. Aug 2, 2017 at 14:15

No, it is (normally) not possible to hit a mine on the first click in Microsoft's implementation of Minesweeper.

It is pretty easy to convince yourself that it is impossible to lose on the first click. Here's a test that I do to gauge the quality of other Minesweeper implementations: Run Minesweeper, create a custom game, and set the board size and number of mines to their maximum allowed values. The Windows 7 version of Minesweeper allows a 24x30 board with 668 mines (92.7% of the board). Start a game, click a random square. Create a new game, repeat. Do it a few more times. The probability that all your first clicks happen to be lucky quickly gets very small (e.g., after 5 times, the probability that you got lucky on all your first clicks drops to (1 - 0.927)5 ≈ 0.000002). Since that is so improbable, the game must be guaranteeing that the first click is always safe. (If that low probability doesn't convince you, keep repeating until it's low enough that it does.)

Additionally, on Windows 7 and later, if you choose to restart a game (with tips enabled), Minesweeper shows a message:

The mines are in the same position as last game. Be careful! You can lose on the first click.

The last sentence implies that normally you cannot lose on the first click.

Finally, old versions of Minesweeper had an `xyzzy` cheat code that indicated whether a square contained a mine. However, when enabling this cheat, clicking on a square that is reportedly a mine will not reveal a mine for the first click, providing further evidence that the game has special logic to prevent a first-move loss. (I have verified that this is true at least as far back as Windows 3.1.)

• So if the objective is to make sure there are no mines, and the mines only get placed after your first click... does that mean someone who ends the game without clicking would have completed the objective? Aug 3, 2017 at 10:20
• @StephanBijzitter The only winning move is not to play? Aug 3, 2017 at 13:23
• @StephanBijzitter the objective is to know where the mines are and which spots are safe. Technically, for the first step, all spots are, though. Aug 3, 2017 at 17:43
• @StephanBijzitter Until the first click, the game is simultaneously lost and won. =P ... well, actually, the objective of the game is to reveal all non-mine squares, so no, you have not won without clicking. Aug 3, 2017 at 18:23