Académique Documents
Professionnel Documents
Culture Documents
Game Playing
Bernhard Beckert
Perfect play
Resource limits
α-β pruning
Games of chance
Defined by
– Initial state
– Successor function
– Goal test
– Path cost / utility / payoff function
“Unpredictable” opponent:
Solution is a strategy specifying a move for every possible opponent reply
Time limits:
Unlikely to find goal, must approximate
Plan of attack
deterministic chance
MAX (X)
X X X
MIN (O) X X X
X X X
X O X O X ...
MAX (X) O
X O X X O X O ...
MIN (O) X X
X O X X O X X O X ...
TERMINAL O X O O X X
O X X O X O O
Utility −1 0 +1
Idea
2-ply game
MAX 3
A1 A2 A3
MIN 3 2 2
A 11 A 12 A 13 A 21 A 22 A 23 A 31 A 32 A 33
3 12 8 2 4 6 14 5 2
Complete Yes, if tree is finite (chess has specific rules for this)
Note
Complexity of chess
Standard approach
Cutoff test
e.g., depth limit (perhaps add quiescence search)
Evaluation function
Estimates desirability of position
E VAL s w1 f 1 s w2 f 2 s wn f n s
Example
w1 9
f1 s (number of white queens) (number of black queens)
bm 106 b 35 m 4
MAX 3
MIN 3
3 12 8
MAX 3
MIN 3 2
X X
3 12 8 2
MAX 3
MIN 3 2 14
X X
3 12 8 2 14
MAX 3
MIN 3 2 14 5
X X
3 12 8 2 14 5
MAX 3 3
MIN 3 2 14 5 2
X X
3 12 8 2 14 5 2
Effects of pruning
Effectiveness
For chess:
Can easily reach depth 8 and play good chess
Checkers
Chess
Deep Blue defeated human world champion Gary 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.
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.
B. Beckert: Einführung in die KI / KI für IM – p.21
Nondeterministic Games: Backgammon
0 1 2 3 4 5 6 7 8 9 10 11 12
25 24 23 22 21 20 19 18 17 16 15 14 13
MAX
CHANCE 3 −1
MIN 2 4 0 −2
2 4 7 4 6 0 5 −2
B. Beckert: Einführung in die KI / KI für IM – p.23
Algorithm for Nondeterministic Games
[− ,+ ] [− ,+ ]
[− ,+ ] [− ,+ ] [− ,+ ] [− ,+ ]
[− ,+ ] [− ,+ ]
[− , 2 ] [− ,+ ] [− ,+ ] [− ,+ ]
[− ,+ ] [− ,+ ]
[ 2 , 2 ] [− ,+ ] [− ,+ ] [− ,+ ]
2 2
[− , 2 ] [− ,+ ]
[ 2 , 2 ] [− , 2 ] [− ,+ ] [− ,+ ]
2 2 2
[ 1.5 , 1.5 ] [− ,+ ]
[ 2 , 2 ] [ 1 , 1 ] [− ,+ ] [− ,+ ]
2 2 2 1
[ 1.5 , 1.5 ] [− ,+ ]
[ 2 , 2 ] [ 1 , 1 ] [− , 0 ] [− ,+ ]
2 2 2 1 0
[ 1.5 , 1.5 ] [− ,+ ]
[ 2 , 2 ] [ 1 , 1 ] [ 0 , 0 ] [− ,+ ]
2 2 2 1 0 1
[ 2 , 2 ] [ 1 , 1 ] [ 0 , 0 ] [− , 1 ]
2 2 2 1 0 1 1
[ −2 , 2 ] [ −2 , 2 ]
[ −2 , 2 ] [ −2 , 2 ] [ −2 , 2 ] [ −2 , 2 ]
[ −2 , 2 ] [ −2 , 2 ]
[ −2 , 2 ] [ −2 , 2 ] [ −2 , 2 ] [ −2 , 2 ]
[0,2] [ −2 , 2 ]
[2,2] [ −2 , 2 ] [ −2 , 2 ] [ −2 , 2 ]
2 2
[0,2] [ −2 , 2 ]
[2,2] [ −2 , 2 ] [ −2 , 2 ] [ −2 , 2 ]
2 2 2
[ 1.5 , 1.5 ] [ −2 , 2 ]
[2,2] [1,1] [ −2 , 2 ] [ −2 , 2 ]
2 2 2 1
[ 1.5 , 1.5 ] [ −2 , 1 ]
[2,2] [1,1] [ −2 , 0 ] [ −2 , 2 ]
2 2 2 1 0
Problem
Backgammon
20 legal moves
TDG AMMON
MAX
.9 .1 .9 .1 .9 .1 .9 .1
MIN 2 3 1 4 20 30 1 400
2 2 3 3 1 1 4 4 20 20 30 30 1 1 400 400
Typical examples
Note
Like having one big dice roll at the beginning of the game
Special case
Bridge
Day 1
Day 2
Day 3
( 10002 100
Note