My friend and I are quite addicted to the MSN game known as Minesweeper Flags. If any of you are familiar
Ah, damn enter button…
Anyway, if any of you are familiar with this game, you know that you must be the first person to reach 26 mines before your opponent. There are a total of 51 mines randomly laid out on a 16x16 grid. The game is set up a lot like regular minesweeper, except you want to get the mines. Now, we were trying to find out the odds of hitting a mine at the start of a new game, where no numbers have been uncovered. One time at the beginning of a game I hit 6 mines without any numbered boxes coming up.
So I need an equation for this. The odds of hitting one of the 51 mines in a 16x16 grid is about 19.92%. How would an equation be set up for each subsequent mine, when there are 50 mines left, on 255 grids, 49 on 254, etc.
Each subsequent selection is an independent event, so just multiply one probability by the next to get the probablility of a particular sequence. If you want the probability of hitting n mines in a row at the beginning, it ends up being:
P(n) = (256-n)!51!/(256!(51-n)!)
Where the exclamation point denotes the factorial function.
-Rick
The factorial functions cause a huge overflow. The probability of getting 4 or 5 is not that intense, so is there any other way to set this up?
Sorry, math was never one of my strong points
You have to be a bit clever about how you calculate the probabilities. For n = 4, you have 252!/256! * 51!/47!. This reduces to 51504948/(253254255256). If you rewrite that as 51/253 * 50/254 * 49/255 * 48/256, you don’t have to worry about overflow.
This can be done algorithmically, but I’ll leave it to you to figure out the details.
The factorials cancel out in large part; you end up with
(51/256)(50/255)(49/254)*…
where you multiply n terms following that pattern to find the probability of getting n mines right off the bat.
These probabilities work out to:[ol][]51/256, or about 1 in 5,[]5/128, or about 1 in 26,[]245/32,512, or about 1 in 130,[]735/514,096, or about 1 in 700,[]About 1 in 3800, and[]About 1 in 20,000.[/ol]
In original Minesweeper, the probability of getting on mine on the first click is zero. So, keep in mind that the game may not adhere to the perfectly random model.
I hit a mine on the first click plenty of times.
Maybe mine’s not the original version? It’s the one that comes packaged with WinXP.
-FrL-
Okay.
Dammit.
You don’t hit a mine on the first try on WinXP. I have proven this to myself as conclusively as I required.
I swear I’ve hit a mine on the first try, many times, in the past. I remember it so clearly.
Guess not on my present computer though, or something.
-FrL-