here is a probability question that has really been anoying me for a while. if we have a minesweeper game with 3x5 squares such that after clicking on two squares the setup is as below (ignore the #'s), wat is the probability that there is a mine in the box marked X?
| ## | ## | ## |
| 2 | ||
| X | ||
| 1 | ||
The vital question here is how you believe
the computer goes about placing the mines in the first place. Does
it mine each square independently with some fixed proability? Does
it place each of a fixed number of mines on a random empty square?
Does it place a random number of mines in this way, and if so what
is the distribution of the number of mines?
My preferred method would be to place a fixed number of mines
randomly, since this appears to be what most versions of
minesweeper do.
In this case it makes sense to condition on whether we believe that
the board contains 2 or 3 mines (it certainly contains no more or
less).
2 mines
Here we certainly have a mine in a blue or ? square, and a mine in
a red square, so the probability of ? being mined is 1/3 (the
probability that the blue-or-? mine is on ?).
3 mines
Here we have 2 mines in red squares and one in a white square, so
we never have a mine on ?.
So we have
But the big question is how does the computer decide how to
place the mines. say we have no information whatsoever about how
the computer does this and that before clicking on any squares the
chances of there being 14 mines is identical to the chances of
there being 1 mine.
Thats essentially what my question has been from the start, what is
the probability of there being two mines.
In standard Windows Minesweeper, isn't
there always a fixed known number of mines at the start?
David
ok lets say we are talking about a game with NxN squares where N
is very large, that way any density of mines in any region is
possible. what are the chances X=mine then?
luqman
By reaching this position you know that
there are either 2 or 3 mines. Suppose that either case is equally
likely before you start the game, so you have P(2 mines) =
P(3 mines) = 1/2. You need to compute
Luqman, you may want to consider the
following in relation to your logic above of taking the average of
2 bounds. You assert that P(A | B and C) must lie between
P(A | B) and P(A | C).
Suppose you have 3 doors, one of which hides a prize. At the outset
you have no information about where the prize is. You open the
first door, and do not reveal the prize (equivalent to clicking on
the 1 square and not finding a bomb). We correctly deduce a
probability of 1/2 that the prize lies behind door 2. Now rewind
time and open door 3 instead. Again, you find no prize (click on
the 2 square and find no bomb) and deduce that the probability of
the prize being behind door 2 is 1/2.
Now by your logic we deduce that if we open doors 1 and 3 and find
no prize behind either, the probability of the prize being behind
door 2 is between 1/2 and 1/2, so must be 1/2. However, it must
certainly be 1.
Steve
thanx steve ur method makes far more sense. i tried to link
conditional proabability into this problem myself but i didnt know
what events to define and how to look at it. after looking at ur
solution i am far more convinved. i can now play minesweeper in
peace!
thanx
luqman
My solution assumes that we know the
probabilities of having 2 or 3 mines, and as written assumes that
they are equal (I in fact assumed them to be 1/2, but equality is
all that is needed), which solves the original problem where this
is the whole board (unless we have more information about how the
number of mines is chosen). For the case of an NxN board of which
this is part, with a known number m of mines in total, the
assumption that the probabilities are equal is unsound. For
example, if we have a huge board with very few mines, we are more
likely to have 2 mines rather than 3. We need to decide how many of
the possible arrangements of m mines on an NxN grid have 2
or 3 in our 5x3 region.
We have a total of N2Cm arrangements, and
15C2 x (N2-15)C(m-2) of them have 2 mines
(and similarly for 3 mines). From here we can plug in numbers of
our choosing and work through to the probability that ? is mined,
though the algebra for general N and m would get
somewhat ugly.
Take as an example the easy setting of Windows Minesweeper, which
has and 8x8 grid with 10 mines. Here we get, well we get a lot of
large numbers which I suspect would overflow most calculators, but
then we get the probabilities
P(2 mines) = 0.3126
P(3 mines) = 0.2580
so indeed the probabilities are not equal
P(2 mines | position) = (1/7 x 0.3126) / (1/7 x 0.3126 +
10/91 x 0.2580)
= 0.4466 / 0.073
= 0.6117
(Note also that the 0.073 is the total probability of this position
occurring on this grid.)
So P(? mined | position) = 0.2039
For comparison, the result of 13/69 obtained before is
0.1884.
As an aside, in light of the probabilities above I should probably
be quite impressed that when I opened minesweeper to check the grid
size, the top-left corner of the grid gave exactly the position we
are considering.
I also have a horrible feeling that this thread may lead to me
programming a computer to play minesweeper after my exams. Actually
the idea of using that as a screensaver quite appeals.
Steve
As for programming a computer to play
minesweeper: there's money in it. It's been shown that to determine
whether the game may be safely solved given a particular set of
initial conditions is an NP-complete problem.
David
By way of revision-avoidance, I knocked up
a program which creates minesweeper boards using my assumptions and
counts those that have a mine on ?. The results from this seem to
support my calculations. If anyone wants to try it, it's here:
http://spinel.chu.cam.ac.uk/misc/mines.php.
Steve
David,
From experience playing Minesweeper, I know there are many cases
when it comes down to a simple 50/50 chance whether a square is a
mine, or it's adjacent square. Surely this rules out any
possibilities of knowing whether a game can be negotiated safely or
not? Therefore, surely a program cannot be written?
Or am I barking up the wrong tree?
It may be possible to write a procedure such that you never get to that situation.
The problem is really to determine whether
or not a given board, with some of the squares uncovered, can be
safely solved, without any dangerous guesswork. This is the
problem that has been shown to be NP-complete.
Incidentally: if I can be facetious for a moment, there is a method
of doing this very effectively that relies on quantum physics and
the "many worlds" theory.
1) Pick a random set of squares that the mines could be on
2) Uncover every other square
3) If your conclusions were wrong, destroy the universe
Then the only universe which does not get destroyed is the one in
which you chose the correct set of squares! So you have solved the
puzzle in the surviving universe. 
David
David, pardon me if I don't feel too happy
about any algorithm including the instruction "destroy the
universe". One small bug and it all gets terribly messy :-).
Steve
David, I think we had a conversation about this sort of thing
before in AskNrich...Something about a machine that will kill you
if you don't win this week's lottery...
The universes will split, and in one you will survive and also be
rich...
Yatir
excuse me if i sound a bit stupid but wat is a NP-complete problem?
It's one of a large set of difficult
combinatorial problems, for which it has been shown that if there
exists a computationally efficient algorithm to solve one of them,
it will solve all of them (they may be transformed into each other
efficiently).
In this context "efficient" means that the running time is bounded
by a polynomial in the size of the problem (the board size here for
example), rather than scaling exponentially or factorially - there
are obvious factorial-time algorithms for a lot of these; you could
just test every possible layout of mines on the board, but the
number of these grows very, very fast for large boards.
One of the 1000000$ Clay prizes is to either find a polynomial-time
algorithm for NP-complete problems, or show that none exists.
David
Surely your "bad-universe" termination algorithm has the possibility of never ending, David. What if every time the random set of squares is picked to be the same as the last choice? - I know, hardly very random, but is probable.
Not in the "many worlds" interpretation -
in this every possible state corresponds to some universe,
necessarily including the one where the problem is sorted
correctly. In this version, when you open the box containing
Schrodinger's cat, the universe splits into two.
David
what r ppl's best times then for minsweeper on intermediate, mine is 42 secs
Mine is 1 sec.
(There is a cheat :-))
Yatir
Really? I heard somewhere that if you type
"XYZZYX" it will give you access to one cheat but this one isn't
really all that helpful. How does the 1s one help?
David
Hold down both left and right mouse
buttons, release and hit Escape. This stops the clock.
Kerwin
Kerwin's cheat is what I use...
Actually you first nead to click the left button, then hold the
right and left button and hit escape (without releasing the escape
button), Otherwise minesweeper will minimize.
Yatir