Professional Documents
Culture Documents
Lec4 - Adversarial Search and Games
Lec4 - Adversarial Search and Games
https://www.youtube.com/watch?v=WXuK6gekU1Y
Khawir Mahmood SE-805 AAI - Adversarial Search and Games 6
Types of Games
Deterministic chance
perfect information chess, backgammon,
checkers, go… monopoly…
imperfect information battleships, bridge, poker,
blind tictactoe… scrabble…
Player( ) = X
Player( X ) = O
X O O
Actions( O X X ) = { , }
X O O
X O O O X O
Result( O X X , ) = O X X
X O X O
O
Terminal( O X ) = false
X O X
O X
Terminal( O X ) = true
X O X
O X
Utility( O X ) = 1
X O X
O X X
Utility( O O ) = -1
O X O
O X X X O X O X X
O O O O X X O
O X X X X O X O X
-1 0 1
O X O X O
Max-Value: Max-Value:
O X X O X X
1 0
X O X O O
O X X X X O
Value: Value:
O X X O X X
1 0
X X O X O O
Khawir Mahmood SE-805 AAI - Adversarial Search and Games 20
Minimax
• 𝑃𝑙𝑎𝑦𝑒𝑟 𝑠 = X Max-Value: X O
1 O X
X O
Min-Value: X O Min-Value: X X O X O
Value:
0 O X X -1 O X O X
1
X O X O X X O
O X O X O O X O X X O
Max-Value: O X X Max-Value: O X X Value: O X O Max-Value: O X
1 0 -1 X O
0 X O O
X O X O O
O X X X X O X X O
Value: O X X Value: O X X Value: O X X
1 X X O
0 X O O
0 X O O
• Tic-Tac-Toe
– ≈ 5 legal moves on average, total of 9 moves (9 plies)
– 59 = 1, 953, 125
– 9! = 362, 880 terminal nodes
• Chess
– b ≈ 35 (average branching factor)
– d ≈ 100 (depth of game tree for a typical game)
– bd ≈ 35100 ≈ 10154 nodes
• Go branching factor starts at 361 (19x19 board)
Khawir Mahmood SE-805 AAI - Adversarial Search and Games 28
Minimax
• Given a state s :
– Max picks action a in Actions(s) that produces highest value of
Min-Value(Result(s, a))
– Min picks action a in Actions(s) that produces smallest value of
Max-Value(Result(s, a))
• Solution:
1. Replace terminal utilities with an evaluation function for non-terminal
positions
2. Use Iterative Deepening Search (IDS)
3. Use pruning: eliminate large parts of the tree
3 2 2
3 2 2
3 2 2
X Y
• If α is better than a for Max, then • If β is better than b for Min, then
Max will avoid it, that is prune that Min will avoid it, that is prune that
branch branch
Khawir Mahmood SE-805 AAI - Adversarial Search and Games 37
Move Ordering
𝑒𝑣𝑎𝑙 𝑠 = 𝑤𝑖 𝑓𝑖 (𝑠)
𝑖=1