Game Development Reference

In-Depth Information

Figure 4.9

Our new rule takes the three safe moves.

revealed squares at the left edge of all the cleared squares. One of them has a

darker outline. There is a 2 and a 3 above those 1 squares. Above that are two

unknown squares. By looking at the four revealed squares above those unknown

squares, we can determine that there is one mine in the two unknown squares.

The 2 and the 3 squares then tell us that there is one unknown mine in the pair of

squares to the left of the 2 and one unknown mine to the right of the 3, in

addition to the flag already there. The 1 under the 2 sees the same mine that the 2

sees, making all squares below it safe. The outlined 1 under the 3 sees the same

additional mine the 3 sees, making all squares below the 1 safe. This gives us four

safe moves that the AI does not see.

Experienced players sometime use three or more tiles to find a move. We could

implement rules that use three or even more tiles, but it begs a question: What's

the point? The AI now can play most games either to completion or to the point

where all that remains is a handful of purely random guesses. A lucky few games

require the player to use some serious brain power or to make the risky guess that

will end the game or unleash the AI anew.

If we added the more sophisticated rules, we would want to create a setting for

the AI so that we could control how deep into the rule base it could go. This