Game Development Reference
Rule-based systems attempt to use the best qualities of hard-coded AI without
their disadvantages—and without constraining the designer to partition the
problem into the independent states of an FSM. Rule-based systems provide a
formal way to store expert knowledge and use it appropriately. (As in the case of
FSM, game AI programmers may use terminology less exactly than researchers.)
Regardless of how they are coded, rules can yield a very entertaining game AI; for
example, the chase mode AI for the ghosts in Pac-Man can be written as four
simple rules [Pittman09].
This chapter looks at what rule-based systems are and considers their advantages
and disadvantages. To illustrate them, this chapter features a project that
implements a rule-based system that plays Minesweeper . This project should be
the most enjoyable project so far. Not only will it provide you with a playable
game including AI assistance, but the presentation is in a ''build a little, test a
little'' style that has more frequent rewards along the way.
The basic idea behind a rule-based AI is very similar to a method school teachers
use with young children. The teacher presents the students with a question.
Some of the children raise their hand. Each student is asked to present his or her
idea as to the answer, and the teacher picks the best of them. The teacher can pick
one or many of the ideas, or possibly have the children work on all the ideas in