CS 21a

Adversarial Search
CS 171/271
(Chapter 6)
Some text and images in these slides were drawn from
Russel & Norvig’s published material
1
Games

Multi-agent environment



Agent needs to consider actions of other
agents
Games: Adversarial Search Problems
Considerations


Many possible moves of other player
Time (need to optimize, or approximate)
2
Game as a Search Problem


Initial State
Successor Function


Terminal test


Note the turn-taking aspect (“ply”)
“Goal”: game over (leaf nodes)
Utility Function

Score or outcome (examples?)
3
Game Tree
4
Infallible Opponent
Assumption

Strategy: select the best move that assumes
the your opponent will make the best play


Need to consider all possible opponent moves
Minimax value of a node in the game tree



Leaf node: minimax value = utility value
Agent (called MAX) picks a move that results in a
state with maximum utility; minimax value of the
node is that maximum
Opponent picks the move that minimizes utility for
the agent; minimax value of the node is that
minimum
5
Minimax Values
6
Minimax Algorithm
7
α-β (alpha-beta) Pruning



May skip examination of some nodes
If a node has no impact on the min/max
choice at upper levels, prune that node
Need to maintain
 α -> highest valued choice so far along
path for MAX
 β -> lowest valued choice so far along path
for MIN
8
α-β pruning: omit examination of these nodes;
Minimum of 2 cannot yield a maximum higher than 3
9
About α-β pruning


Effectiveness is highly dependent on
order in which successors are examined
Can reduce effective tree depth to half
its value
10
Other Considerations
in Games

Because of time constraints, may have
to settle with estimate of utility
(evaluation function)


Non-terminal nodes turned into leaves
Elements of chance


e.g., dice and cards
Min, max, and chance nodes
11
State of the Art


Checkers: Chinook ended 40-year-reign of human
world champion Marion Tinsley in 1994. Used a
precomputed endgame database defining perfect
play for all positions involving 8 or fewer pieces on
the board, a total of 444 billion positions.
Chess: Deep Blue defeated human world champion
Garry Kasparov in a six-game match in 1997. Deep
Blue searches 200 million positions per second, uses
very sophisticated evaluation, and undisclosed
methods for extending some lines of search up to 40
ply.
12
State of the Art


Othello: human champions refuse to compete
against computers, who are too good.
Go: human champions refuse to compete
against computers, who are too bad. In go, b
> 300, so most programs use pattern
knowledge bases to suggest plausible moves.
13