# Minesweeper probability

I ran into the situation pictured in the minesweeper game below. Note that the picture is only a small section of the entire board.

Note: The bottom right 1 is the bottom right corner tile of the board and all other tiles have been marked/deemed safe. What we know:

• There are exactly 2 bombs left on the board
• Bombs can't be: (A & B) || (A & C) || (B & D) || (C & D)
• Bombs can be: (A & D) || (B & C)

Can anyone prove if there is a square(s) that is more likely to be safe/unsafe or is every square equally likely to be safe/unsafe?

• Side note: thank you for the extremely good looking advertisement on the bottom of that link. – barak manos Aug 28 '15 at 14:16
• As an aside, if you like to be able to logically deduce the solution to each minesweeper game you play without needing to resort to guesswork, look up Simon Tatham's portable puzzle collection (available for many platforms). But some people feel that guessing is simply part of the game. – Oliphaunt - reinstate Monica Aug 29 '15 at 11:15

You know

• exactly one of A and C is a bomb
• exactly one of B and D is a bomb
• exactly one of A and B is a bomb

So, as you say, there are two possibilities

• A and D are bombs while B and C are not
• B and C are bombs while A and D are not

As far as I can tell, these have the same likelihood

• If anyone else can confirm that this is indeed correct I will mark it as such. This was my original assumption. – viss3240 Aug 28 '15 at 14:31

You've correctly inferred that there are only two possibilities:

1. The two bombs are at $$A$$ and $$D$$.
2. The two bombs are at $$B$$ and $$C$$.

Common sense now dictates that these two options are equally likely. The only way to prove that the two options are equally likely requires knowledge of how the minesweeper board was generated. It would be in the spirit of minesweeper if information about the positions of the bombs could only be inferred from the board itself, and not from the underlying code generating the boards. So if the minesweeper game was 'properly' coded then yes, both option are equally likely. But unless you can give us the code of the specific minesweeper game you're playing, there is no way to prove such a claim.

Here's a mathematically rigorous proof of the statement:

Let's assume the board consists of $n$ fields of which $k$ are mines and the field is created by randomly choosing $k$ numbers from $1$ to $n$ without repetitions. This is a reasonable assumption, since the Fisher-Yates-Shuffles would yield an effective and easy way to create a random field and every field would be possible and equally likely.

We introduce the random variables A, B, C, D that are $1$ if the corresponding field has a mine and $0$ else. We can infer the following information from the positions of flags and numbers: $$A + B = A + C = B + D = 1$$

What you now want to calculate is a conditional probability: \begin{align*}&P(A = 1 | A + B = A + C = B + D = 1) = \frac{P(A = 1, A + B = A + C = B + D = 1)}{P(A + B = A + C = B + D = 1)} \\ &= \frac{P(A = D = 1, C = B = 0)}{P(A + B = A + C = B + D = 1)} \\ &= \frac{P(A = D = 1, C = B = 0)}{P((A = D = 1, C = B = 0) \vee (A = D = 0, C = B = 1))}\end{align*}

Now the two events $\{A = D = 1, C = B = 0\}$ and $\{A = D = 0, C = B = 1\}$ are disjoint, so the probability of their union is the sum of their probabilities. It is easy to see that they both have the same probability, namely ${n - 4\choose k - 2}\cdot {n \choose k}^{-1}$. Since the Event in the numerator also holds with the same probability, this yields $$P(A = 1 | A + B = A + C = B + D = 1) = \frac{1}{2}.$$

So it's a 50:50 change whether the bombs are on $A$ and $D$ or on $B$ and $C$.

• You arew right, I will correct it. – Dominik Aug 29 '15 at 16:08

They are all equally likely to be safe. The restrictions given by the numbers tell you that

1. (Exactly) one of A & C is a mine.
2. One of A & B is a mine.
3. One of B & D is a mine.

There are exactly 2 configurations that satisfy these restrictions: A & D are mines or B & C are mines. Assuming these are equally likely (probably a fair assumption, but I don't know how minesweeper generates its configurations), each square has half a chance of being a mine. Of course, this analysis is based on no more relevant information being present in the rest of the board (it looks like this segment is the bottom left corner? But I can't tell for sure).