MINEHELP.EXE ============ MineHelp is a little nonsense program which assists you with the Minesweeper game included in Windows 3.1. It is able to solve the simple parts of the puzzle, leaving only the really challenging ones to you. This program is free, no warranties of course. It should always be distributed as a package containing MINEHELP.EXE, MINEHELP.PAS (TPW source code), MINEHELP.RES (resource file) and MINEHELP.DOC (this document). Description =========== You can start MineHelp at any time. When Minesweeper is not active, MineHelp just sits and waits; as soon as Minesweeper is started, MineHelp begins to analyze the game situation. When started, MineHelp displays a little dialog box: Status: ------- Inactive: MineHelp doesn't do anything. Active: When you press the OK button, MineHelp will do one step towards the solution of the puzzle, according to the "Level" settings. If it doesn't find a move, it does nothing, and it is up to you to figure out the next step. Automatic: MineHelp continuously monitors the mine field and does what it can do to solve the puzzle. It will only stop when there is no obvious thing to do (and "Level" is not set to "Random"). Level: ------ Basic: MineHelp will only do the basic tricks: clearing around a square if there are already enough squares marked as mined, or marking all covered adjacent squares if their number adds up to the total number of mines. Expert: MineHelp will also solve problems which depend on two numbered squares. Here is a typical situation: .::, (X means any nubered field) X21, The ':' region contains one mine at most, but the '2' XXX, square needs two mines in its neighbourhood. Hence, '.' is a mine, and the ',' fields are all safe. Random: If it doesn't find a move using the "basic" and "expert" strategies, MineHelp will uncover a square at random. This can go wrong, of course. Animation: MineHelp will move the mouse cursor around on the mine field ---------- while it simulates mouse clicks. Remarks: - If "Status" is "Automatic" and "Level" is "Random", MineHelp ======== effectively attempts to solve the puzzle without user interaction. - These options take effect immediately; there's no need to press the OK button. The OK button is only for single-step execution in "active" mode. Command line arguments ====================== The program parameter is a single string of lowercase (sorry) characters. c: MineHelp will start iconized h: MineHelp will start hidden (and probably remain so) i: initial status will be "inactive" a: inital status will be "active" b: initial level will be "basic" r: initial level will be "random" n: animation will be on initially. Defaults: window visible, status automatic, level expert, animation off. Example: minehelp cab -> Start iconized, status is active, level is basic. How it works ============ MineHelp analyzes the Minesweeper window by finding its position on the screen and then examining the contents of the mine field squares. It does this by reading pixels at strategic locations, using Windows' GetPixel function. The program then analyzes the current position and sends the appropriate mouse clicks to the Minesweeper window. In "automatic" mode, MineHelp uses a timer to examine the mine field once every second. Limitations =========== - MineHelp works only when Minesweeper is in color mode. - Minehelp doesn't do anything if the mine field is not fully visible on the screen. - The program relies on the Minesweeper window dimensions and on the colors and shapes of the bitmaps used for the squares. If this should change with future Minesweeper versions, MineHelp would stop working. - MineHelp doesn't make mistakes (hopefully), except in "Random" mode; however, it always assumes that the marks on the mine field are correct. - In automatic mode, you cannot safely use the "?" feature, because the first right mouse click will produce a "mark", which is taken literally by MineHelp. - In automatic mode, Minesweeper sometimes loses the "button up" message from a *user's* mouse click. This leaves the clicked square in a "pushed" state, which looks like a safe field with no mines around it to MineHelp. Performance =========== In automatic/random mode, MineHelp solves Minesweeper's "Expert" mode in about 20% of all cases. The time used to solve the puzzle depends of course on the processor speed, but also on the speed of the video driver. On a Compaq 486/33M with QVision card, the best score was 7 seconds (usually 9 to 15). On a 386/20, times are around 50 seconds. What could be improved ====================== - MineHelp doesn't take into account the number of remaining mines displayed in the upper left corner of Minesweeper's window. This information is often useful in the final phases of the game. - "Random" mode does not have to be completely random; there could be some basic probability calculations. - MineHelp cannot solve problems which depend on more than two numbered squares. These situations are quite rare, but here's a simple one: XXX The '.' and ',' regions both contain exactly one mine, therefore .1XX ':' is safe. .21X :,,X Have fun.... Peter Karrer pkarrer@bernina.ethz.ch