slide 1
Game Playing
Part 1 Minimax Search
Yingyu Liang yliang@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison
[based on slides from A. Moore http://www.cs.cmu.edu/~awm/tutorials , C. Dyer, J. Skrentny, Jerry Zhu]
Game Playing Part 1 Minimax Search Yingyu Liang yliang@cs.wisc.edu - - PowerPoint PPT Presentation
Game Playing Part 1 Minimax Search Yingyu Liang yliang@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison [based on slides from A. Moore http://www.cs.cmu.edu/~awm/tutorials , C. Dyer, J. Skrentny, Jerry Zhu] slide 1
slide 1
[based on slides from A. Moore http://www.cs.cmu.edu/~awm/tutorials , C. Dyer, J. Skrentny, Jerry Zhu]
slide 2
slide 3
slide 4
slide 5
[Shamelessly copied from Andrew Moore]
slide 6
[Shamelessly copied from Andrew Moore]
slide 7
[Shamelessly copied from Andrew Moore]
Zero-sum: one player’s gain is the other player’s loss. Does not mean fair. Discrete: states and decisions have discrete values
slide 8
[Shamelessly copied from Andrew Moore]
Zero-sum: one player’s gain is the other player’s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions
slide 9
[Shamelessly copied from Andrew Moore]
Zero-sum: one player’s gain is the other player’s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls – no chance
slide 10
[Shamelessly copied from Andrew Moore]
Zero-sum: one player’s gain is the other player’s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls – no chance Perfect information: each player can see the complete game state. No simultaneous decisions.
slide 11
[Shamelessly copied from Andrew Moore]
Zero-sum: one player’s gain is the other player’s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls – no chance Perfect information: each player can see the complete game state. No simultaneous decisions.
slide 13
slide 14
slide 15
(ii ii) Max Convention: score is w.r.t. the first player Max. Min’s score = – Max who is to move at this state
slide 16
(ii ii) Max (i ii) Min (- ii) Min Symmetry (i ii) = (ii i)
slide 17
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max
slide 18
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1
slide 19
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min
slide 20
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min
(- i) Min
slide 21
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min
(- i) Min (- -) Min
slide 22
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min
(- i) Min (- -) Min
(- -) Min
slide 23
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min
(- i) Min (- -) Min
(- -) Min
(- -) Max +1
slide 24
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min (- -) Min
(- i) Min (- -) Min
(- -) Min
(- -) Max +1 (- -) Max +1
slide 25
slide 26
(ii ii) Max (i ii) Min (- ii) Min (i i) Max (- ii) Max (- i) Max (- i) Max (- -) Max +1 (- i) Min +1 (- -) Min
(- -) Min
(- -) Max +1 (- -) Max +1
(- -) Min
(- i) Min +1
slide 27
(ii ii) Max (i ii) Min (- ii) Min (i i) Max +1 (- ii) Max +1 (- i) Max
(- i) Max
(- -) Max +1 (- i) Min +1 (- i) Min +1 (- -) Min
(- -) Max +1 (- -) Max +1
(- -) Min
(- -) Min
slide 28
(ii ii) Max (i i) Max +1 (- ii) Max +1 (- i) Max
(- i) Max
(- -) Max +1 (- i) Min +1 (- i) Min +1 (- -) Min
(- -) Max +1 (- -) Max +1
(- -) Min
(- -) Min
(- ii) Min
(i ii) Min -
slide 29
(i i) Max +1 (- ii) Max +1 (- i) Max
(- i) Max
(- -) Max +1 (- i) Min +1 (- i) Min +1 (- -) Min
(- -) Max +1 (- -) Max +1
(- -) Min
(- -) Min
(- ii) Min
(i ii) Min -
(ii ii) Max
slide 30
(i i) Max +1 (- ii) Max +1 (- i) Max
(- i) Max
(- -) Max +1 (- i) Min +1 (- i) Min +1 (- -) Min
(- -) Max +1 (- -) Max +1
(- -) Min
(- -) Min
(- ii) Min
(i ii) Min -
(ii ii) Max
slide 31
(ii ii) Max
(i ii) Min
(- ii) Min
(i i) Max +1 (- ii) Max +1 (- i) Max
(- i) Max
(- -) Max +1 (- i) Min +1 (- -) Min - 1 (- i) Min +1 (- -) Min
(- -) Min - 1 (- -) Max +1 (- -) Max +1 Symmetry (i ii) = (ii i) Convention: score is w.r.t. the first player Max. Min’s score = – Max who is to move at this state
slide 32
slide 33
function Max-Value(s) inputs: s: current state in game, Max about to play
if ( s is a terminal state ) then return ( terminal value of s ) else α := – for each s’ in Succ(s) α := max( α , Min-value(s’)) return α function Min-Value(s)
if ( s is a terminal state ) then return ( terminal value of s) else β := for each s’ in Succs(s) β := min( β , Max-value(s’)) return β
slide 34
function Max-Value(s) inputs: s: current state in game, Max about to play
if ( s is a terminal state ) then return ( terminal value of s ) else α := – for each s’ in Succ(s) α := max( α , Min-value(s’)) return α function Min-Value(s)
if ( s is a terminal state ) then return ( terminal value of s) else β := for each s’ in Succs(s) β := min( β , Max-value(s’)) return β
O(bm) bad
O(bm)
slide 35
A O W
B N
4
F G
X
E D C R P
9
Q
S
3
T
5
U
V
K M H
3
I
8
J L
2
slide 37
(ii ii) Max
(i ii) Min
(- ii) Min
(i i) Max +1 (- ii) Max +1 (- i) Max
(- i) Max
(- -) Max +1 (- i) Min +1 (- -) Min
(- i) Min +1 (- -) Min
(- -) Min
(- -) Max +1 (- -) Max +1