## Using Hints

Minestein contains a two stage hint system: when the user clicks on the hint button a logically solvable cell is identified by a "?" symbol; a second click on the hint button will expose or flag the cell - whatever is appropriate. However, while the "?" is displayed the user can work out the solution and set the cell in the normal way. Having the hint cell identified is a great help as it shows the user a cell whose content can be inferred from its environment. But, because it does not simply show the answer, the user can still work out what to do. It is a good way to learn how to analyse grids and play the game. A hint example is shown in Figure 1.

Figure 1. Apart from those at the edge, each cell touches 8 other cells (up, down, left, right and diagonally). The blue cells have yet to be solved. The number in a cell is the count of the number of mines that touch the cell. A flag indicates a cell that the user believes to be a mine. The "?" in the cell at 7,4 indicates a hint and hence that that cell can be solved by logic: the cell at 6,5 contains a "2" meaning it touches 2 mines; at present it is touching 1 cell flagged as a mine and is touching only one hidden cell - the one marked with "?"; this cell must, therefore, be a mine. The user can place a flag on the cell using a right mouse click (a second right click on a flagged cell will remove the flag). Next, as the "?" is a mine, then the "2" in cell 7,5 is already touching 2 mines and so none of the other cells it touches can be mines and hence they can safely be exposed. A cells is exposed by a left mouse click.

The hint button can be still used even when the user has selected to use the "Original" mode. The program will apply the currently active algorithm(s) and show a hint if any are possible. If not the users only recourse is to guessing or the "Show answer" button.

### Hint algorithms

The program uses two algorithms to create logical puzzles and provide hints. Algorithm 1 is always used, but Algorithm 2 is optional.

The standard analysis method - "Algorithm 1" simply examines the counts for the exposed cells to see if they can be accounted for by their neighbours. For example if a cell has a mine count of 2 and is touching exactly one flagged cell and exactly one hidden cell, then the hidden cell must be a mine.

Algorithm 2 is a "brute force" method. It tries every possible pattern of mines around each hidden cell to see which patterns are compatible with the flagged cells and the mine counts shown in the exposed cells. Then for these compatible patterns it checks to see if any particular cell is consistently either mined or unmined. If so, then that consistent state must be its correct solution. As an example of the process: if a cell has four hidden cells near to it, then there will be 24 = 16 possible arrangements of mines: 0000, 0001, 0010, 0011, 0100, 0101, 0110,... 1111; where 1 represents mined and 0 unmined. The program fills the 4 hidden cells with each of these 16 patterns in turn and checks the results. If it finds the consistency described above, it will have solved a cell. When this algorithm is switched on any hints that require it are shown as "??".