Minesweeper

Yesterday I wrote a little program to play Minesweeper so I could graph what the likelihood of winning was given certain bomb densities.

Over 19,000 games:



(The X axis is bomb density, Y is winning percentage)

Currently the AI only flags bombs based on O(n) algorithms. I don't do any hypothetical-true-leads-to-inconsistent-state eliminations which get into exponential time, though I'll probably add that sometime.

Of course, sometimes it's just a 50/50 chance and no logic will help.

BOARD 511:

 1 2 X 2 1   1 1 1   1 1 2 1 1   1 * * 1       1 * 2 * 1 1 * * 2
 3 * . * 2   1 * 2 1 2 * 3 * 1 1 2 3 2 1   1 1 2 1 2 1 2 2 4 * 2
 * * * * 2   1 2 * 1 2 * 3 1 1 2 * 2 1 1 2 2 * 2 2 2 2 2 * 2 2 2
 3 4 3 3 3 2 1 1 1 1 1 1 1     2 * 3 2 * 3 * 4 * 2 * * 2 1 2 2 *
 * 2   1 * * 2       1 1 1     1 1 2 * 2 3 * 3 1 2 2 3 2 1 2 * 3
 * 3 1 1 4 * 4 1     1 * 1         2 2 3 3 3 2       1 * 1 2 * 2
 2 * 1   2 * * 1 1 1 2 1 2 1 1 1 1 2 * 3 * * 1   1 1 3 2 2 1 2 2
 2 2 2   1 3 3 2 1 * 1 1 2 * 1 1 * 3 3 * 3 2 1   2 * 4 * 1   1 *
 1 * 2 2 2 3 * 3 2 1 1 1 * 3 2 1 1 2 * 2 2 1 1   3 * * 2 2 1 3 2
 1 1 2 * * 3 * * 2 1 1 3 4 * 2     1 1 1 1 * 1 1 3 * 3 1 2 * 4 *
     1 2 2 2 3 * 2 1 * 2 * * 4 3 3 2 1   1 2 2 2 * 3 3 2 4 * 4 *
       1 1 1 1 2 2 2 1 2 2 3 * * * * 1     2 * 3 2 * 2 * * 2 2 1
       1 * 1 1 2 * 1       1 2 5 * 4 1     2 * 2 1 2 3 3 3 2 2 1
       2 2 2 1 * 2 1         1 3 * 3 1     2 2 2   1 * 1 1 * 3 *
 1 1 1 1 * 1 1 1 1       1 1 2 * 3 * 1     1 * 1   1 1 1 1 2 4 *
 1 * 1 1 1 1             1 * 2 1 2 1 1     1 1 1           1 * 2
DEAD!