Download presentation
Presentation is loading. Please wait.
1
Game playing
2
Imperfect Information
Type of games Deterministic Chance Imperfect Information Backgammon Bridge Perfect Information Chess Here we consider Games with Perfect Information
3
Example - Tic-Tac-Toe O X O X O X -10 O X O X O X O X 10 -10 10 O X O
-10 O X O X O X O X 10 -10 10 O X O X O X O X O X O X 10 -1 10
4
Minimax search MAX node MIN node value computed by minimax f value
5
Minimax search
6
Minimax algorithm
7
Properties of minimax Complete? Yes (if tree is finite)
Optimal? Yes (against an optimal opponent) Time complexity? O(bm) Space complexity? O(bm) (depth-first exploration) For chess, b ≈ 35, m ≈100 for "reasonable" games exact solution completely infeasible
8
Alpha-beta pruning We can improve on the performance of the minimax algorithm through alpha-beta pruning. We don’t need to compute the value at this node. No matter what it is it can’t effect the value of the root node. 2 1 2 7 1 ?
9
Alpha-beta pruning
10
Alpha-beta pruning
11
Alpha-beta pruning
12
Why is it called α-β? Define β similarly for min
13
The Alpha-Beta Procedure
There are two rules for terminating search: Search can be stopped below any MIN node having a beta value less than or equal to the alpha value of any of its MAX ancestors. Search can be stopped below any MAX node having an alpha value greater than or equal to the beta value of any of its MIN ancestors.
14
The α-β algorithm
15
The α-β algorithm
16
Properties of α-β Pruning does not affect final result
Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(bm/2) doubles depth of search
17
The Alpha-Beta Procedure
Example: max min max min
18
The Alpha-Beta Procedure
Example: max min max = 4 min 4
19
The Alpha-Beta Procedure
Example: max min max = 4 min 4 5
20
The Alpha-Beta Procedure
Example: max min = 3 max = 3 min 4 5 3
21
The Alpha-Beta Procedure
Example: max min = 3 max = 3 = 1 min 4 5 3 1
22
The Alpha-Beta Procedure
Example: max = 3 min = 3 max = 3 = 1 = 8 min 4 5 3 1 8
23
The Alpha-Beta Procedure
Example: max = 3 min = 3 max = 3 = 1 = 6 min 4 5 3 1 8 6
24
The Alpha-Beta Procedure
Example: max = 3 min = 3 = 6 max = 3 = 1 = 6 min 4 5 3 1 8 6 7
25
The Alpha-Beta Procedure
Example: = 3 max = 3 min = 3 = 6 max = 3 = 1 = 6 min 4 5 3 1 8 6 7
26
The Alpha-Beta Procedure
Example: = 3 max = 3 min = 3 = 6 max = 3 = 1 = 6 = 2 min 4 5 3 1 8 6 7 2
27
The Alpha-Beta Procedure
Example: = 3 max = 3 min = 3 = 6 = 3 max = 3 = 1 = 6 = 2 min 4 5 3 1 8 6 7 2
28
The Alpha-Beta Procedure
Example: = 3 max = 3 min = 3 = 6 = 3 max = 3 = 1 = 6 = 2 = 5 min 4 5 3 1 8 6 7 2 5
29
The Alpha-Beta Procedure
Example: = 3 max = 3 min = 3 = 6 = 3 max = 3 = 1 = 6 = 2 = 4 min 4 5 3 1 8 6 7 2 5 4
30
The Alpha-Beta Procedure
Example: = 3 max = 3 = 4 min = 3 = 6 = 4 max = 3 = 1 = 6 = 2 = 4 min 4 5 3 1 8 6 7 2 5 4 4
31
The Alpha-Beta Procedure
Example: = 3 max = 3 = 4 min = 3 = 6 = 4 max = 3 = 1 = 6 = 2 = 4 = 6 min 4 5 3 1 8 6 7 2 5 4 4 6
32
The Alpha-Beta Procedure
Example: = 3 max = 3 = 4 min = 3 = 6 = 4 max = 3 = 1 = 6 = 2 = 4 = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 7
33
The Alpha-Beta Procedure
Example: = 4 max = 3 = 4 min = 3 = 6 = 4 = 6 max = 3 = 1 = 6 = 2 = 4 = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 7 7
34
The Alpha-Beta Procedure
Example: = 4 Done! max = 3 = 4 min = 3 = 6 = 4 = 6 max = 3 = 1 = 6 = 2 = 4 = 6 min 4 5 3 1 8 6 7 2 5 4 4 6 7 7
35
Games that include chance
Possible moves (5-10,5-11), (5-11,19-24),(5-10,10-16) and (5-11,11-16)
36
Games that include chance
chance nodes Possible moves (5-10,5-11), (5-11,19-24),(5-10,10-16) and (5-11,11-16) [1,1], [6,6] chance 1/36, all other chance 1/18
37
Games that include chance
[1,1], [6,6] chance 1/36, all other chance 1/18 Cannot calculate definite minimax value, only expected value
38
Expected minimax value
EXPECTED-MINIMAX-VALUE(n)= UTILITY(n) If n is a terminal maxs successors(n) MINIMAX-VALUE(s) If n is a max node mins successors(n) MINIMAX-VALUE(s) If n is a max node s successors(n) P(s) . EXPECTEDMINIMAX(s) If n is a chance node These equations can be backed-up recursively all the way to the root of the game tree.
39
Position evaluation with chance nodes
Left, A1 wins Right A2 wins Outcome of evaluation function may change when values are scaled differently. Behavior is preserved only by a positive linear transformation of EVAL.
40
Alpha-beta pruning in games with chance
We can improve on the performance of the minimax algorithm for games with chance through alpha-beta pruning. We don’t need to compute the value at these nodes. 3 4 - 4 0.5 ? - 1 5 = 1 2.5 = 0.5 Suppose -5 e(n) 5 = 3 * (- 1) * 0.5 = 1.0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.