LikeLike

]]>https://github.com/EdLogg/MineSweeper

LikeLike

]]>LikeLike

]]>LikeLike

]]>I have updated my code to use a 64 bit pseudo random number generator (KISS) and sped up the program. I can give you a more updated numbers but for the expert game using 60,000 sample puzzles using 600 random seeds:

Pos Wins Percent est. Dev.

——————————————

3,3 28297 47.16% .21%

3,2 28172 46.95% .20%

2,3 28218 47.03% .20%

4,3 28030 46.72% .20%

3,4 28011 46.69% .20%

So there is really three best starting places in the upper left quadrant. So my original issue of why 3,2 was better than 2,3 was really a case of small test samples.

LikeLike

]]>I was thinking of writing a solver myself – and started down the same path, of deductive thinking. I didn’t get to code, but tried what I thought out manually on a few expert boards. And then I found this: https://massaioli.wordpress.com/2013/01/12/solving-minesweeper-with-matricies/ IMO, it sort of models deductive thinking in a better way than using rules as a human would like them. In each step, you just have to write equations for all already uncovered squares. Fortunately, solving sytems of at best thousands of linear equations is an extremely light task for modern computers. You can, of course, optimize by always running a simple, straightforward step of marking all squares which _have to_ be mines and which are certainly without mines after each solving of the linear system.

LikeLike

]]>LikeLike

]]>Testing medium puzzles gives us the following results with each set being

5000 puzzles using 10 seeds each (and endPlay=30, Guess1Offset=-0.03):

Pos Set1 Set2 Totals Percent Std. Dev.

————————————————————————————————————–

1,1 4358 4297 8655 86.55% 0.87%

2,2 4413 4359 8772 87.72% 0.88%

2,1 4376 4352 8728 87.28% 0.87%

1,2 4369 4339 8708 87.08% 0.87%

3,3 4400 4330 8730 87.30% 0.87%

3,2 4432 4337 8769 87.69% 0.88%

2,3 4393 4345 8738 87.38% 0.87%

4,4 4384 4313 8697 86.97% 0.87%

Using start=3,2, endPlay=30, guess1Offset=-.03 we get the following

using 1000 samples:

Percent 87.6% deviation = 2.77%

Guess1 used= 100

Guess2 used= 309

Guess 1 failed=17.0%

Guess 2 failed=34.6%

Average guesses per win=0.26

Average guesses per loss=1.43

Average Win Prob= 94.0%

Average Loss Prob= 59.0%

Average Guess 1 Prob= 89.7%

Average Guess 2 Prob= 67.5%

Wins with guesses

0 1 2 3 4 5 6 7 8+

730 99 30 6 6 1 3 0 1

Testing SMALL puzzles gives us the following results with each set being

5000 puzzles using 10 seeds each (and endPlay=30, Guess1Offset=-0.03):

Pos Set1 Set2 Totals Percent Std. Dev.

————————————————————————————————————–

1,1 4816 4817 96.33 96.33% 0.96%

2,2 4844 4858 9702 97.02% 0.97%

2,1 4836 4835 9671 96.71% 0.97%

1,2 4846 4843 9689 96.89% 0.97%

3,3 4849 4840 9689 96.89% 0.97%

3,2 4840 4849 9689 96.89% 0.97%

2,3 4812 4823 9635 96.35% 0.96%

4,4 4813 4813 9626 96.26% 0.96%

Using start=3,2, endPlay=30, guess1Offset=-.03 we get the following

using 1000 samples:

Percent 96.7% deviation = 3.06%

Guess1 used= 35

Guess2 used= 73

Guess 1 failed=5.7%

Guess 2 failed=42.5%

Average guesses per win=0.07

Average guesses per loss=1.21

Average Win Prob= 98.4%

Average Loss Prob= 50.8%

Average Guess 1 Prob= 95.6%

Average Guess 2 Prob= 57.3%

Wins with guesses

0 1 2 3 4 5 6 7 8+

909 48 10 0 0 0 0 0 0

LikeLike

]]>LikeLike

]]>Start Win w/o Guess1

———————

0,0 38.6% 33.4%

1,1 44.7% 41.0%

2,2 47.2% 45.3%

2,1 45.5% 43.1%

1,2 46.2% 43.6%

3,3 47.5% 45.8%

3,2 47.7% 45.5%

2,3 47.0% 45.1%

3,1 45.0% 43.4%

1,3 45.4% 43.7%

4,4 45.9% 44.7%

4,3 47.4% 45.8%

3,4 47.2% 45.2%

4,2 46.0% 44.7%

2,4 46.7% 45.6%

4,1 45.4% 43.6%

1,4 45.7% 44.0%

0,7 44.6% 41.6%

1,7 45.7% 44.3%

2,7 47.0% 45.2%

3,7 46.4% 45.1%

4,7 46.0% 44.2%

As you can see Guess1 helps a few percent.

LikeLike

]]>