Minesweeper Solver/Player

This is a fun little program I wrote in my free time in mid 2004. It locates Microsoft's Minesweeper game (winmine.exe) on your computer, then launches it and plays the game automatically.
It works like this:

  1. Clicking on a random square
  2. Scanning the playing field (taking a tiny screenshot of each square, and comparing them to known images to determine what the value of each revealed square is)
  3. Determining if a mine was found (game over - start a new game)
  4. Running a little bit of logic to determine which squares are safe to click on
  5. If any safe squares were found, click on them, then go to step 2, else go to step 1

The program uses a little trickery to ensure it will not overwrite any of your high scores.

To try to solve a different difficulty, open Minesweeper, change the difficulty however you want (custom works fine, too!), then close Minesweeper and run the Minesweeper Solver.

This works on Windows XP. I believe it will also work fine on Win95/98/ME/2000. It will probably not work on Vista, because the graphics of the Minesweeper game were likely changed.

The source code is zipped below, but it's also in my subversion repository.

AttachmentSize
Minesweeper Solver.exe60 KB
Minesweeper Solver Source Code.zip34.43 KB