How to Write your own Minesweeper AI
luckytoilet.wordpress.com
luckytoilet.wordpress.com
Side note: for those of you inclined to try this, or make use of Java's Robot class in any way, a word of warning: Robot takes over your mouse and/or keyboard entirely, so if things go wrong (e.g. an infinite loop) you'll have to restart your computer. It can do far worse if you're not careful, too, so feel free to read up on the mistakes of others before running in guns blazing.
http://alvinalexander.com/java/java-robot-class-example-mous...
You can play with an HTML5 demo here: http://mrgris.com/projects/minesweepr/demo/player/
One fun side-effect is that once you have the core algorithm, you realize there's no reason minesweeper must be constrained to a grid. It works just as well on hexagonal tiles or on the surface of a cube.
There might be one square that's unlikely to contain a mine, but also unlikely to help much in solving the rest of the board. You might even be able to infer exactly what it will be before you click on it. Then, if there is another square that's a bit more likely to have a mine but also more likely to help, you can click on that one instead.
What I can find is http://www.minesweeper.info/wiki/Main_Page. Those guys aren't aware of this, and claim to see games repeated (http://www.minesweeper.info/wiki/Dreamboard). That debunks the theory.
In the past I've had a side project involving automating casino games for fun. I followed this tutorial for automating simple web games with Python:
http://active.tutsplus.com/tutorials/workflow/how-to-build-a...
This tutorial uses Python Image Library (PIL) for 'reading' the UI and PyWin to manipulate the mouse in order to play the game. I would suggest using AutoPy instead of PyWin to give platform-agnostic GUI manipulation:
Cool project overall though, nice AI example.
As an aside, I find the whole area of bots automating repetitive human tasks fascinating, here's an excellent book about this topic (did you know a guy wrote a Lisp program that can compose orchestras in the style of Bach and fool human critics?):
I recently published my own minesweeper AI, and it does only a subset of what your program does. The explanations in your article would be applicable to my work too.
My program plays the pre-Vista/7 version of Windows Minesweeper, so the graphics detection is much simpler. I only implemented a strategy that considers a single cell and its neighbors, a strategy that considers pairs of cells and their neighbors, and random guessing.
http://nayuki.eigenstate.org/page/automatic-minesweeper-solv...