Somewhat OT... Computer playing Minesweeper

Christopher T King squirrel at WPI.EDU
Wed Jul 14 09:41:10 EDT 2004


On Wed, 14 Jul 2004, Heiko Wundram wrote:

> 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:

Rather than trying all possibilities of the mine field as a whole, why not 
just take it one number at a time?  Not all portions of the mine field are 
dependent on the field as a whole; you can greatly decrease the number of 
patterns checked if you work in this way.

IMHO Python is the wrong language to be doing this in though -- a
constraint-logic language like Prolog would be much more well suited to
the task (indeed, you could probably write a Minesweeper solver in a few
dozen lines of Prolog).  It may be a lot easier to implement a CL
algorithm in Python, and then to formulate your problem using that.




More information about the Python-list mailing list