Next: About this document ...
Foundations of Artificial Intelligence
CSE 573 -- Fall 2001
Game PlayingKautz
|
Game Playing - Why?
- Game playing is one of the oldest areas of AI. In 1950's Claude Shannon
the inventor of information theory) and Alan Turing wrote some of the
first chess programs. Since then steady progress has been made in
many games and several programs can challenge world champions (two
things led to this - speed of computers and better search methods).
- Provides a structured task in which it is very easy to
measure success or failure. True. What's nice about it is that typically games
are well-defined.
- Not much knowledge required intially ...thought that straightforward search would be the
solution. Turned out not to be the case except for the simplest of
games -- the search space is just too big.
- Why is tic-tac-toe boring? Search space is small enough that
most adults can determine the perfect move.
- Focus has been on games of perfect information: tic-tac-toe,
chess, checkers, Go, Othello, backgammon. Knowledge available to each person is
the same. Games of imperfect information include poker (can't see the other's
hand) and bridge.
Game Playing
An AI Favorite
- structured task
- not initially thought to require large amounts of knowledge
- focus on games of perfect information
Game Playing
- Initial State
-
- Operators
-
- Terminal Test
-
- Utility Function
-
A game can be defined as a search problem with the following components:
We've already converted some games into search problems, e.g.,
8-puzzle...
- Initial State
- initial board/position and an indication of
whose move it is.
- Operators
- define the set of legal moves from any position
- Terminal Test
- determines when the game is over, hopefully
the game is in a goal state (i.e., you have won).
- Utility Function
- gives a numeric outcome for the game.
Example in tic-tac-toe and chess the outcome is win (+1), draw (0), lose(-1)
Some games have wider payoffs. For example, backgammon has a payoff range
from +192 to -192.
Game Playing
- Initial State
- is the initial board/position
- Operators
- define the set of legal moves from any position
- Terminal Test
- determines when the game is over
- Utility Function
- gives a numeric outcome for the game
Game Playing as Search
1#1
Winston, p. 102. Generic game tree. Original board; new boards, etc.
- Want to find path from initial state to goal. What if we try
to apply one of our usual search algorithms. Exhaustive search:
definitely not practical. Heuristic search? Fine for single-player
games. Search for sequence of moves that leads to winning position.
- Two player games are different. Second player has some say about
his/her moves and probably won't choose the move that helps the first
player.
- This kind of tree is referred to as an and-or tree.
(regular search is an OR tree.) Want to find a subtree (starting at
the root), such that exactly one branch is selected when it's Max'x move and
every branch is considered at Min's move. Strategy has to anticipate anything
that Min does. OR-for Max, can choose move 1 or 2 or 3. AND-at Min
level; have to consider all of Min's possible moves.
Partial Search Tree for Tic-Tac-Toe
2#2
3#3
5#5
Simplified Minimax Algorithm
- Expand the entire tree below the root.
- Evaluate the terminal nodes as wins for the minimizer or maximizer.
- Select an unlabeled node, 6#6, all of whose children have been assigned
values. If there is no such node, we're done -- return the value assigned to
the root.
- If 6#6 is a minimizer move, assign it a value that is the minimum of the
values of its children. If 6#6 is a maximizer move, assign it a value that is
the maximum of the values of its children. Return to Step 3.
- In game tree search, a move is a pair of actions. One player's
action is a ply. 2-ply = one move.
- Called a minimax decision because it maximizes the utility
under the assumption that the opponent will play perfectly to minimize it.
- Time complexity: 8#8 (9#9 plies and 10#10 branching.)
Impractical for e.g. chess (11#11 to 12#12).
The Need for Imperfect Decisions
- Problem:
- Minimax assumes the program has time to search to the terminal
nodes.
- Solution:
-
The Need for Imperfect Decisions
- Problem:
- Minimax assumes the program has time to search to the terminal
nodes.
- Solution:
- Cut off search earlier and apply a heuristic evaluation
function to the leaves.
13#13
Static Evaluation Functions
Minimax depends on the translation of board quality into a single,
summarizing number. Can be difficult. Expensive.
- Add up values of pieces each player has (weighted by importance
of piece). E.g. intro chess: pawn = 1pnt; knight or bishop = 3pnts;
rook = 5 pnts; and queen = 9pnts.
- Isolated pawns are bad. How well protected is your king?
How much maneuverability to you have?
Do you control the center of the board?
- How many plies with perfect eval function?
14#14
Design Issues of Heuristic Minimax
- Evaluation Function:
- What features should we evaluate and how
should we use them? An evaluation function should:
15#15
Linear Evaluation Functions
-
16#16
- 17#17 -- weight; 18#18 -- feature
- Steps in designing an evaluation function:
- Pick informative features
- Tune the weights
Deep Blue: precision in eval (normalized, beteen 0 -- 1)
is 19#19 to 20#20 ! (lots of fine-tuning is important)
21#21
Creating Evaluation Functions
- Features / weights for chess?
- How tune weights?
- How find features?
22#22
Design Issues of Heuristic Minimax
- Search:
- search to a constant depth
- Problems:
-
23#23
Design Issues of Heuristic Minimax
- Some portions of the game tree may be ``hotter'' than others. Should
search to quiescence. Continue along a path as long as one move's static
value stands out (indicating a likely capture).
- Horizon effect
- Secondary search. (singular extension heuristic)
Next: About this document ...
Don Patterson
2001-12-14