Somewhat OT... Computer playing Minesweeper

Heiko Wundram heikowu at ceosg.de
Tue Jul 13 22:12:46 EDT 2004


Am Mittwoch, 14. Juli 2004 04:02 schrieb Heiko Wundram:
> Anyway, as I said, I don't know if __iterConsistentFields() does what it
> should, that's basically why I asked... And I don't know whether this
> approach is the best approach to solving a minefield...

PS-ing myself: I can't see a better (in terms of finding the solution) 
approach, but of course this algorithm lacks speed, as the amount of 
consistent states can become quite large for a single field which has very 
much scattered information, like:

. . . . . . . . . x . x x . x . . . . . . . . . . . . x . .
. . . . . . . . . x x . . . . . . x . x . . x . x . . . x .
. . x x . . x . . x . . . . . . x . . . . x . . . . . . 2 .
. . . . . . . . x . . x . . . . x . . . . . . . x . . . . x
. . . . . . . . x . . . . . . . . . . . x x . . . . . . . .
. x . . x x x x . . . . . . . x . . . . x . . . . . x x . .
x 2 . x x . . . . . . . . . . 2 . . . . . . x . . . . x . .
. 2 1 3 . . x . . x x . x . . x . . . . x x . . . . . x . .
x 2 . . x . x . . x . . . . . x x . . . . . x . . x . . . .
. . x . . . . . . x . . . x x . . x x . . . . . . 2 . . . .
. . . . . . . . . . . x . x . x . x . x x . . . . . x . . .
. x x . . . . . . . . x . . x . . . x . . . . . . . . x . x
. . . . x . . . . . . x . . . x . . . . . x x . . . . . . .
. x . . x . . . . . . . . . . x x . . . . . . . . . . . . .
x . . . x . . . x x x . . x . . x x . . . . x . x . . . . .
. . . . . . . . x x . . . . . . x . . . . . . . . . . x . .

With the numbers being the only fields which were discovered so far. The 
number of states which are possible only taking this information into account 
already goes into the millions.

As an example, my algorithm required about half an hour to solve this 30x16 
field with 99 mines, on an Athlon XP 2400+...

Heiko.



More information about the Python-list mailing list