8
$\begingroup$

I am trying to calculate the odds, for every square (Except M or Q) of a mine being there, without knowing the total mines on the board.

I've found 2 different formulas online, which are similar except for one portion & although produce the same number for some sections, a very different answer is given for sections of the board. For example, the blue section I have 2 different answers for.

enter image description here

As you can see I've split up the squares into logical sections, where the probability will be the same.

For better explanation, the board looks like this:

ABCDE
F3G1H
IJ1KL
MNOPQ

The sections, broken up by the number they 'touch':

Section           # of bombs in section:
-------           ----------------------
(A+B+C+F+G+I+J) = 3
(C+D+E+G+H+K+L) = 1
(G+J+K+N+O+P)   = 1

Note: that I am using the # of bombs to mean the number of bombs contained inside the squares. For example, The green section (A+B+F+I) are 4 squares. At most 4 squares can have 4 mines (1 mine per square). In our case green cannot contain 4 mines though, because of the '3'.

Further broken up, Here we get the sections you see in the image. By breaking up sections when we know which squares will give the same odds. I will call these the 'known solutions', or 'absolute solutions' (The right column is the # of bombs inside all of the squares combined):

(A+B+F+I) + (C) + (G) + (J) = 3
(G) + (C) + (D+E+H+L) + (K) = 1
(J) + (N+O+P) + (K) + (G) = 1

Here we calculate all of the possible solutions.

We do this by making assumptions. First we assume (C) has 1 bomb. In other words, the 'C' square is a bomb. (C is chosen at random, but I prefer to start with a small section). I'll call the first solution 'A1-1':

(C) = 1

Since (C) = 1, and ((G) + (C) + (D+E+H+L) + (K)) = 1, we know that (G), (K) and (DEHL) are must be 0:

(G) = 0
(D+E+H+L) = 0
(K) = 0

But now we need to make another assumption. I chose (J) = 1. Again, I prefer starting with small sections. This gives us an entire solution (A1-1):

Grouping   # of bombs
--------   -----------
(C)       = 1
(D+E+H+L) = 0
(K)       = 0
(G)       = 0
(J)       = 1
(N+O+P)   = 0
(A+F+I+B) = 1

I'll keep assuming (C) is 1 until we've come up with every solution (Note the 'absolute solutions' must always hold true, since that's how Minesweeper works, and we want to utilize what we know:

(a1-2)      # of bombs
----        ----------
(C)       = 1
(D+E+H+L) = 0
(K)       = 0
(G)       = 0
(J)       = 0
(N+O+P)   = 1
(A+F+I+B) = 2

That's all for C = 1, so next we assume G=1:

a2-1        # of bombs
----        ----------
(C)       = 0
(G)       = 1
(D+E+H+L) = 0
(K)       = 0
(N+O+P)   = 0
(J)       = 0
(A+F+I+B) = 2

a2-2
----
(C)       = 0
(G)       = 0
(J)       = 1
(A+F+I+B) = 2
(N+O+P)   = 0
(D+E+H+L) = 1
(K)       = 0

a2-3
----
(C)       = 0
(G)       = 0
(J)       = 0
(K)       = 1
(D+E+H+L) = 0
(A+F+I+B) = 3
(N+O+P)   = 0

a2-4
----
(C)       = 0
(G)       = 0
(J)       = 0
(K)       = 0
(D+E+H+L) = 1
(A+F+I+B) = 3
(N+O+P)   = 1

That gives us every solution.

Now we list the number of bombs in every possible solution:

Note that: (A+F+I+B) is Green, (C) is Pink, (D+E+H+L) is orange, (G) is brown, (J) is Yellow, (K) is Purple (N+O+P) is blue:

#:      A1  A12 A21 A22 A23 A24
GREEN:  1   2   2   2   3   3
PINK:   1   1   0   0   0   0   
ORANGE: 0   0   0   1   0   1
BROWN:  0   0   1   0   0   0
YELLOW: 1   0   0   1   0   0
PURPLE: 0   0   0   0   1   0
BLUE:   0   1   0   0   0   1

Now we calculate the combinations possible for every solution. This is done by using nCr (Binomial coefficient).

Where N = Number of Squares and B = numberOfBombs.

Combinations = N NCR B.

For the first solution (A1-1) these are the combinations:

(GREEN)   = 4 NCR 1 = 4
(PINK)    = 1 NCR 1 = 1
(ORANGE)  = 4 NCR 0 = 1
(BROWN)   = 1 NCR 0 = 1
(YELLOW)  = 1 NCR 1 = 1
(PURPLE)  = 0 NCR 1 = 1
(BLUE)    = 3 NCR 0 = 1

Multiplying these combinations we get: 4*1*1*1*1*1*1 = 4 combinations for this solution (A1-1).

Doing the same for all solutions we get:

#:      A1  A12 A21 A22 A23 A24
GREEN:  4   6   6   6   4   4
PINK:   1   1   1   1   1   1   
ORANGE: 1   1   1   4   1   4
BROWN:  1   1   1   1   1   1
YELLOW: 1   1   1   1   1   1
PURPLE: 1   1   1   1   1   1
BLUE:   1   3   1   1   1   3
TOTALS: 4   18  6   24  4   48

Total combinations = 104

Note: In the above table, to get 'TOTALS' we multiply all combinations to get the total combinations for that solution.

Now for the part that I am conflicted on. I choose 'Blue' to demonstrate, since I am getting a different answer using either method.

Method 1:

For each solution take the number of mines divided by the number of squares (3) and multiply by the combinations:

A1-1      A1-2      A2-1    A2-2     A2-3    A2-4
(0/3*4)   (1/3*18)  (0/3*6) (0/3*24) (0/3*4) (1/3*48)

Adding those numbers up (Taking away the 0's to make it easier):

(1/3*18) + (1/3*48) = 22.

Now divide by the total combinations (104):

22/104 = 0.212.

However there are 3 squares, so we can divide by 3 if we want the odds of a single square in the section:

0.212/3 = 0.0705

Method 2

Multiply the total combinations for the non-zero values (48 + 18), divide by the total combinations (104):

1*66/104 = .635.

Again we can divide by 3 if we want the odds of a single square:

.635/3 = .212

So, are my odds for hitting a mine on any given blue square .212%, .0705%, or something else?

$\endgroup$
5
$\begingroup$

First of all, I upvoted because you have presented an intriguing problem coupled with what appears to be a reasonable try at a solution. I did not understand your work, however. Even if I had, this is not the approach that I would take.

I would write a computer program to :

  1. Identify and count all possible mine configurations that satisfy the original conditions. Denote this count as $d$.

  2. Identify and count all possible mine configurations that satisfy the original conditions, and also satisfy that one of the blue squares contains a mine. Denote this count as $n$.

Then the desired probability is $n/d.$

I regard the above as the industrial strength approach. I also suspect that any alternative approach that attempts to use mathematical analysis will be very problematic.

Addendum-1

I scrutinized the OP's query until "Now for the part that I am conflicted on...", and I didn't bother trying to decipher the subsequent portion of his posting. In my opinion, his logic is flawless to that point and in fact he has solved the problem.

Assuming that I am not mistaken, the answer is $x/y$, where

$x = 18+48$ and

$y = 4+18+6+24+4+48$.

Addendum-2

See also Minesweeper revisited which confronts the issue that the cases examined in this answer (e.g. the 104 cases referred to in addendum-1) are not equally likely.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ I've updated my answer with more of an explanation, I am splitting the squares into groups, where they contain the same odds. $\endgroup$ – dustytrash Nov 23 '19 at 5:22
  • $\begingroup$ @dustytrash I understood your edited query up to "...Here we calculate all of the possible...". In order to get me or someone else to take a thorough look at your analysis you're going to have to further edit your query so that it is impossible for the reader to be confused. $\endgroup$ – user2661923 Nov 23 '19 at 8:55
  • $\begingroup$ Updated my answer. Reading it this morning I see how it was confusing / lacking explanation $\endgroup$ – dustytrash Nov 23 '19 at 16:16
  • $\begingroup$ @dustytrash Your revision looks much better, but still needs some editing, unless I have misinterpreted your work. Specifically, at the point where you write "We do this by Making an assumptions. First we assume (C) = 1", it appears that you are using the equation "(C) = 1" ambiguously to represent that square C has a mine &/or that of all the squares touching square C, exactly one of them has a mine. If I have interpreted your query correctly, you need to edit the query to remove the ambiguity. $\endgroup$ – user2661923 Nov 23 '19 at 19:18
  • $\begingroup$ I've updated my answer, I meant that C=1 means C Is a mine, since C is 1 square in length. $\endgroup$ – dustytrash Nov 23 '19 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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