Game Development Reference
In-Depth Information
revealed 1 means that a second move should certainly be taken. A revealed 2 is
less rosy. The second move itself might reveal a 0, yielding two free squares. This
configuration of a square of four cleared tiles tends to yield deterministic moves.
If the second move reveals the same number as the first move, the second move
generates five free moves. In either case, the resulting shape of the perimeter gives
a superior board to play from. This is shown on the third board of Figure 7.5,
where there is a pair of cross the T moves available for two more squares. The
equally lowest-risk second move available here yields more follow-up moves and
far better playing position.
Can We Apply This?
An AI that computes these numbers on the fly to evaluate openings to Mine-
sweeper would be far more involved than the AI we used in Chapter 4. It would
involve both statistics as well as some look-ahead, which we covered in Chapter 6.
If the exact statistics were beyond the skills of the AI programmer, Monte Carlo
methods mentioned in Chapter 5, ''Random and Probabilistic Systems,'' could
be used to home in on the right moves. None of these methods would run faster
or give a better result than simply adding a highly specialized set of rules to the AI
that already has the right moves coded in.
Note that we did not do the full-up, no-holds-barred statistical analysis to prove
that the first moves rank in the order presented. Besides lowering the complexity
of the analysis we did, this effort was intentionally skipped to let us drive the
following point home: The AI does not always have to have the exact optimum
move if it has moves that are good enough. Mozart might be the best great
composer whose music is in the public domain, but he is not the only great
composer whose music is free.
When adding a book of moves to an AI, the programmer must pay as much
attention to the integration as to the parts. A good integration is seamless,
making it hard to detect when the AI is playing from the topic or playing from a
more general method. A thin book that has a small number of stellar moves
added to modestly good general AI will be obvious to the player and not always
entertaining. If the player stumbles from the conditions where the AI plays using
the modestly difficult general AI into the conditions where the AI plays from the
expert-level book of moves, the player may feel blindsided or be convinced that
the AI cheated once it saw the player getting ahead. Going the other way may not
be any better, leaving the player wondering why a challenging AI decided to roll