Berto's Itsmine Page

last modified: 20030802

Good old minesweeper ....

Click here to download the itsmine solver/assistant for minesweeper (, 26Kb)

This program is freeware.

PS. If you winmine is not called 'minesweeper' (eg. the french version is called démineur) make a short cut and add in the target field of the properties tab the string name=démineur, or whatever minesweeper is called. That should do the job.


The Itsmine algorithm

Itsmine has an internal representation of the board, one byte for every cell. When the solve button is clicked it searches for the (real) minesweeper program, grabs its window-handle and reads (by getting a HDC for that window) the current board. The first time after startup is tries to decide if it sees the windows 3.11 or the win95 version of the game, since both games have slightly different bitmaps for the digits.

Internally the solver has 2 fifo (first in, first out) que-es, one for (new) cells that contain a mine, and the other one for cells that are known to be safe. If the mine-que is not empty, it takes the first element of that que and places a mine, and updates all 8 neighbours. If one of the neighbours is now know to be safe it is added to the save-que). If the mine-que is empty, the save-que is checked, again it can have the result that fields are now known to be mines (and they are appended to the mine-que) or are save and are added to the save-que.

If both que-es are empty the whole board is compared but now by looking at two fields at a time, again this can lead to fields to be added to one of the two que-es.

Note that the program never looks at more than 2 cells at the same time !

Back to Berto's Home Page