123

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

  • 2
    Tangentially related on Puzzling.SE: Is it always safe to start on the lower left-hand corner? – antimo Aug 3 '17 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. – jamesdlin Aug 4 '17 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. – Pharap Aug 4 '17 at 12:12
  • 2
    I did a minesweeper game during my first semester in college and generating the map after first click was a very trivial thing. – Sulthan Aug 6 '17 at 8:08
132

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

  • 4
    On newer versions (Win 7+) it should be possible to hit a mine with the first click. – dly Aug 2 '17 at 6:40
  • 2
    What if all four corners are occupied? – nalzok Aug 2 '17 at 8:34
  • 6
    @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. – Samthere Aug 2 '17 at 9:46
  • 47
    @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. – Toomai Aug 2 '17 at 10:30
  • 4
    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. – John Hamilton Aug 2 '17 at 14:15
109

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

  • 16
    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? – Stephan Bijzitter Aug 3 '17 at 10:20
  • 27
    @StephanBijzitter The only winning move is not to play? – Malco Aug 3 '17 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. – Chieron Aug 3 '17 at 17:43
  • 4
    @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. – jamesdlin Aug 3 '17 at 18:23

protected by Jutschge Aug 7 '17 at 15:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.