Professional Documents
Culture Documents
P1 starts
P2 replies
P1
P2
P2 loses
P1
P2 loses
P1 loses
to maximize
Node score = 0
means MIN wins.
1 means MAX wins.
Bold edges indicate
forced win for MAX,
Player2.
MIN wins
MAX wins
MIN wins
Minimax
Create a utility function
Evaluation of board/game state to determine
how strong the position of player 1 is.
Player 1 wants to maximize the utility function
Player 2 wants to minimize the utility function
Minimax tree
Generate a new level for each move
Levels alternate between max (player 1
moves) and min (player 2 moves)
Minimax tree
Max
Min
Max
Min
Minimax tree
Max
Min
Max
100
Min
23 28
21
-3
12 4
70 -3
-12 -70 -5
Minimax tree
Max
Min
Max
28
-3
12
70
-3
100
-73
-14
-8
Min
23 28
21
-3
12 4
70 -3
-12 -70 -5
Minimax tree
Max
Min
Max
-4
-3
21
-3
12
70
-4
-73
100
-73
-14
-8
Min
23 28
21
-3
12 4
70 -4
-12 -70 -5
Minimax tree
Max
-3
Min
Max
-4
-3
21
-3
12
70
-4
-73
100
-73
-14
-8
Min
23 28
21
-3
12 4
70 -4
-12 -70 -5
Minimax Evaluation
Given average branching factor b,
and depth m:
A complete evaluation takes time bm
A complete evaluation takes space bm
Cuts
If the current max value is greater
than the successors min value, dont
explore that min subtree any more
Cut example
Max
-3
Min
Max
-3
21
-3
-4
12
70
-4
-73
100
-73
-14
Cut example
Max
Min
Max
21
-3
12
-70
-4
100
-73
-14
Cut example
Max
Min
Max
21
21
-3
12
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
-3
21
-3
12
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
12
-3
21
-3
12
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
-70
-3
21
-3
12
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
-70
-3
21
-3
12
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
-70
-3
21
-3
12
-73
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
-70
-3
21
-3
12
-73
-70
-4
100
-73
-14
Cut example
Max
Min
Max
-3
-70
-3
21
-3
12
-73
-70
-4
100
-73
-14
cuts
Similar idea to cuts, but the other
way around
If the current minimum is less than
the successors max value, dont look
down that max tree any more
Cut example
Min
Max
Min
21
21
21
70
-3
12
73
70
-4
100
73
-14