Game Development Reference

In-Depth Information

we will leave them separate so that we can control how smart our AI appears. We

also leave them separate because one version is easier for humans to see than the

other. Both of these points are game-design issues. We want our AI to play like a

human and we want to easily control how well it plays.

So how will the rule work? It takes a revealed square and attempts to use a nearby

square as a helper. In the simpler version of the rule, the nearby helper is adjacent

to the original revealed square. The two squares need to share some blank

squares, and the original square also needs to be adjacent to some blank squares

that are not shared. The helper square computes the minimum number of mines

and the minimum number of clear squares that are in the shared squares. These

numbers can be zero but not negative. If either number is greater than zero, the

helper has provided the original square with potentially new information. The

original square already has information about
all
of its squares, but the helper

gives information about a
subset
of them. If the minimum number of mines in

the shared squares is equal to the number of mines the original square has not yet

placed, the original square can safely click all the squares that are not shared

because it knows that all of its mines are somewhere in the shared squares. If the

minimum number of clear squares in the shared squares is equal to the number

of unknown clear squares around the original square, then all the non-shared blank

squares around the original square must be mines. This rule does not act on the

shared squares; it acts on the original square's private squares. If your brain is in

danger of exploding, perhaps a picture will make the situation clear (see Figure 4.6).

The upper 1, with the dark border, is the helper square. The lower 1 is the original

square. The rule will not work the other way around because the upper 1 has no

private blanks. The lower 1, the original square, has three private blanks, in

addition to four shared blanks. The helper can compute that at least one mine

must be in the shared squares; it sees one mine, and the only thing around it is

shared squares. The original square needs to place one mine, and the helper just

told it that at least one mine is in the shared squares. That was all the mines

the original square had left to place, so the private squares must all be clear. If

there are any flags nearby, they adjust the various numbers, but the method is the

same. Note that the move is in the original square's private blank squares. The

two squares do not yield enough information to safely determine anything about

the shared squares. Note that the move consumes all the private blank squares.

The same method also places mines. If the original square had been a 4 and

the helper square remained a 1, the helper would report that there are at least