Unit 2c Game Playing (Compatibility Mode)
Unit 2c Game Playing (Compatibility Mode)
– This rules out searching all the way to the end of the game
Types of game environments
Deterministic Stochastic
Perfect information
Chess, checkers, go Backgammon,
(fully observable) monopoly
Imperfect information
Battleships Scrabble, poker,
(partially observable) bridge
Game tree
• A game of tic-tac-toe between two players, “max” and “min”
http://xkcd.com/832/
http://xkcd.com/832/
Heuristic function
For chess: A very simple static evaluation function
based on piece advantage was proposed by Turing
for chess—simply add the values of black's pieces
(B), the values of white's pieces (W), and then
compute the quotient W/B.
• A more sophisticated approach was that taken in
Samuel's checkers program, in which the static
evaluation function was a linear combination of several
simple functions, each of which appeared as though it
might be significant.
• Samuel's functions included, in addition to the obvious
one, piece advantage, such things as capability for
advancement, control of the center, threat of a fork, and
mobility.
These factors were then combined by
attaching to each an appropriate weight
and then adding the terms together. The
complete evaluation function had the
form:
A two-ply game
Game tree search
3
3 2 2
3 2 2
• Minimax(node) =
Utility(node) if node is terminal
maxaction Minimax(Succ(node, action)) if player = MAX
minaction Minimax(Succ(node, action)) if player = MIN
Optimality of minimax
4,3,2 1,5,2
http://web.cs.ucla.edu/~rosen/161/notes/alphabeta.html
http://people.cs.pitt.edu/~litman/courses/cs2710/lectures/pruningReview.pdf
Alpha-beta pruning
• It is possible to compute the exact minimax decision
without expanding every node in the game tree
Alpha-beta pruning
• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
3
Alpha-beta pruning
• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
3 2
Alpha-beta pruning
• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
3 2 14
Alpha-beta pruning
• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3
3 2 5
Alpha-beta pruning
• It is possible to compute the exact minimax decision
without expanding every node in the game tree
3 2 2
Alpha-beta pruning