Game Development Reference
In-Depth Information
the execution part of a rule. This is the flip side of an advantage; great freedom
includes the freedom to create a nightmare. The temptation to drown the system
with a rich set of rules must be balanced against the additional cost required to
evaluate each new rule.
The Minesweeper Project
Our project is based on the ubiquitous Minesweeper game. We will implement
both the game and the AI to help play it. The game requires more code than the
AI, but the game code is generally less complex than the AI code. Not surpris-
ingly, the basic game code will need additions to accommodate the AI. The AI
will make moves through the same code pipeline that implements player moves.
The added code allows the AI to sense the world. The AI commonly asks the
world what squares neighbor a given square. The AI is also interested in the
number of mines that need to be placed around a square and the number of
unmarked squares surrounding a given square.
In our project, each rule will report the number of moves it can make. This
customizes the general idea of each rule, reporting how well it fits the situation.
The emphasis here is on how much gain each rule proposes to deliver. The rule
with the highest number of proposed moves will be executed. Our project will
also order the rules by cost. The costs are fixed and roughly based on the com-
plexity of the rule's matching algorithm. The framework breaks ties by using the
lowest-cost rule with the highest proposed gain. Since the lowest-cost rules are
checked first, the first rule with the best score can be the rule used.
Implementing the Basic Game
The game itself will have three main components: squares, a playing field to hold
them, and a control panel. In addition, we will need an AI to help play it. The AI
will assist the human player, helping to spot moves and making them when
requested. A fully automatic AI is left as an exercise. We will again use a spiral
model of development. We start with the basics of the parts and add sophisti-
cation each time we go around rather than writing each part completely before
going on to the next part.
The Playing Field
The most basic part of the game is the playing field. The minefield of an expert
level game spans 30 columns and 16 rows. Our tiles will be 30-pixel squares, so we
Search Nedrilad ::

Custom Search