Minimax and Alpha-Beta Reduction: Borrows From Spring 2006 CS 440 Lecture Slides
Minimax and Alpha-Beta Reduction: Borrows From Spring 2006 CS 440 Lecture Slides
Motivation
Want to create programs to play games
Types of Games
Deterministic
Nondeterministic
(Chance)
Fully
Observable
Chess
Checkers
Go
Othello
Backgammon
Monopoly
Partially
Observable
Battleship
Card Games
Basic Idea
Search problem
An initial state
Operators
Terminal Test
Utility Function
Utility Function
utility(State)
Examples
Two Agents
MAX
MIN
Basic Algorithm
Example
Coins game
MAX
MIN
N=4
K=
1
N=3
K=
3
2
3
N=0
K=
2
N=1
K=
F(S)=1
1
N=3
K=
1
N=1
K=
2
N=0
K=
F(S)=0
1
N=0
K=
F(S)=1
F(S)=0
N=2
K=
N=2
K=
N=1
K=
2
N=0
K=
1
N=1
K=
1
N=0
K=
F(S)=1
1
N=0
K=
F(S)=1
F(S)=0
MAX
MIN
1
N=3
K=0
Solution
N=4
K= 1
3
2
3
N=0
K= 1
2
N=1
K=0
F(S)=1
1
N=3
K= 0
1
N=1
K=1
2
N=0
K=0
F(S)=0
1
N=0
K= 1
F(S)=1
F(S)=0
N=2
K=1
N=2
K=0
N=1
K=1
2
N=0
K=1
1
N=1
K=0
1
N=0
K=1
F(S)=1
1
N=0
K=0
F(S)=1
F(S)=0
Analysis
Max Depth: 5
Branch factor: 3
Number of nodes: 15
Even with this trivial example, you can see that
these trees can get very big
Alpha-Beta Pruning
Alpha-Beta Pruning
MIN
Algorithm
MAX
MIN
1
N=3 =
K= =
=
=
3
N=0
K=
F(S)=1
=
=
N=4 =
K= =
2
N=1 =
K= =
1
N=3
K=
F(S)=0
2
1
=
=
N=2 =
K= =
1
N=1 =
K= =
3
N=2 =
K= =
2
N=0
K=
2
F(S)=1
N=0 =
K= =
1
F(S)=0
N=0 =
K= =
F(S)=1
=
=
1
N=1 =
K= =
N=1
K=
1
N=0
K=
1
F(S)=1
N=0 =
=
K= =
F(S)=0
MAX
MIN
N=4 =0
K=01 =
=0
=1
= 1
=
3
N=0
K=1
F(S)=1
=0
=1
N=3 =
N=2 =0
K=10 = 10
K = 1 0 = 0
=0
1
2
2
1
=
N=1 =0
N=2 =
N=0
N=1 =0
K=0 = 10 K=1 =0
K=1
K= =0
N=1
K=1
1
N=0
K= 1
1
N=3
K=0
1
2
F(S)=1
N=1 =1 N=0 =
K=1 =0 K= =
1
F(S)=1
N=0 =0 =0
K=0 =0 =
F(S)=0
1
F(S)=0
N=0 =1
K=1 =0
F(S)=1
F(S)=0
Nondeterministic Games
Weighted coin
.6 Heads (1)
.4 Tails (0)
Example
N=2
K = 8.6
Random Node
0
K=5
K = .4*2 + .6*7 = 5
0
K=2
1
K=7
Our Project
Conclusion