Correct probability calculation for Minesweeper When I play Minesweeper, every now and then I reach a point where I have to make a guess. I then try to calculate the probability for every option to be a mine in order to choose the safest move. But sometimes I find that different calculations result in different probabilities, which means I'm doing it wrong in some sense, and this is what I want to clarify.
Below is an example of such a dilemma.

Notice the green mark in the upper-left region. I have two choices next to the 4-mark, each with a probability of $\frac{1}{2}$.
On the other hand, from the 5-mark point of view, we need to select 2 squares out of 3, suggesting a $\frac{2}{3}$ probability for each square.
We can also follow a third calculation, by starting from the 2-mark on the rightmost square on this remaining "island": if the upper square is a mine, it can be easily seen that the upper square of the 4-mark must also be a mine; if not- it can be shown that both 4-mark squares have equal probability to be mines. This implies that the upper 4-mark square has probability of $\frac{3}{4}$ to be a mine - again a contradiction.
A more "desperate" attempt would be to say that all three "calculation trajectories" are equally likely, thus we need to add the calculated probabilities and sum them up with a factor of $\frac{1}{3}$. But that is quite awkward, and I'm sure there is more solid reasoning here, but I wasn't able to prove it myself.
So... what is the correct way to calculate the probability?
As a last remark - I assume here that the remaining island is large enough such that no further meaningful information can be extracted from the remaining squares, such as the number of remaining mines, or a direct enumeration of all possible mine distributions.
Thanks, and I hope you find this intriguing as I do. :)
 A: You get different probabilities because in each case you only consider a particular part of the board, and thus in each case you only consider only a strict part of all the information that is there. So, there really aren't any contradictions here.
If you want to know what the probability is given the whole board, then your calculations will become more complicated. In fact, you'd have to take into account even more than those three 'trajectories' you mentioned ...  and if you add the information that there are exactly 10 more mines to place, it becomes more complicated yet.
Still, I would say that your third line of reasoning (that start with the 2 in the top right of the open region) probably gets closest to the actual probability, for the following reasons:


*

*It takes into account the most information (indeed, it includes the information regarding the 5-square).  

*There is a good bit of room left at the top left, thus you can easily pack different numbers of mines there, so even knowing there are 10 mines left should minimally impact/constrain what could happen next to that 2.

*The 3 flags stacked on top of each other next to the 5 naturally carve the space in a 'left' and 'right', and there is no direct line of reasoning as to how satisfying the numbers on the left will impact what happens on the right.
So, the number of ways you can work out having a mine directly to the left of the top right 2 should be very close to the number of ways you can have a mine below that ... meaning that I would agree that, even if you take into account the whole board, the probability of a mine in each of those squares is indeed around $1/2$, and with that, the probability of the top square next to the 4 being a mine is indeed very close to 3/4
In general, though, yeah, try and take into account everything as is 'humanly possible' ... which in most cases is not considering how many more mines there are.  But the example you gave here does show how certain lines of reasoning take into account more information than others, and the more information you take into account, the closer you tend to get to the  probability if you somehow could take into everything.
A: There is no meaningful way to calculate such probabilities without knowing the algorithm that minesweeper uses to generate the board. You would then compute the probability that, say, the top square contains a mine as:
$$P(\text{Top square is mined})=\frac{P(\text{Algorithm would generate a compatible board with a mined top square})}{P(\text{Algorithm would generate a compatible board})}$$
Where a "compatible" board means a placement of mines consistent with the clues you already have and the mines you've already revealed.
There really is no simpler way since the algorithm could potentially be very complicated in order to avoid generating boards that are boring to solve. You could try solving toy versions of the problem in which the board is selected uniformly, or where each square is mined independently with probability $p$, which I imagine would lead to rather tedious combinatorics computations involving working out exactly how many configurations of mines are consistent with the clues you already have.
A: First, I would label the squares. Pretending the green area is like a matrix, $M$, use the same indexing conventions. Hence, $M_{4,2}, M_{3,2}, M_{1,2}$, and $M_{1,3}$ are blank. Now list all the possibilities.
The following lists the possible ways there could be mines at each position, given just the green box.
$M_{4,2}, M_{1,2}, M_{1,3}$
$M_{3,2}, M_{1,2}$
$M_{3,2}, M_{1,3}$
Hence, given the box there is a 1/3 chance there is a mine at $M_{4,2}$, and a 2/3 chance there is a mine at $M_{3,2}$. Picking $M_{4,2}$ would be better.
A: To calculate the probability you need to first determine all the positions that mines can be placed to correctly satisfy all the known information on the whole board.
Then for each position you need to calculate the 'weight' for the position, i.e. how many ways this position can be formed. This is done by, using combinatorics, calculating how many ways the remaining mines (not used to satisfy the known information) could be positioned in the remaining space (not next to information tiles).
Then the total number of solutions is the sum of the 'weights'.
The probability of a tile containing a mine is the sum of the weights across the positions that have a mine in that tile divided by the total number of solutions.
Some work has been done in this area and there are threads discussing it on the minesweeper reddit page. The best automated solvers use optimised variations on this approach to help them make their decisions.
