Adversarial Search: Course: Artificial Intelligence Effective Period: September 2018
Adversarial Search: Course: Artificial Intelligence Effective Period: September 2018
Adversarial Search
Session 04
1
Learning Outcomes
At the end of this session, students will be able to:
2
Outline
1. Games
3. Alpha-Beta Pruning
5. Exercise
3
Games
• Games is a search problems
4
Games
• Games are interesting because they are too hard to solve
5
Kind of Games
• Abstraction: To describe a game we must capture every
relevant aspect of the game, such as:
– Chess
– Tic-tac-toe
6
Kind of Games
• Unpredictable opponent: introduces uncertainty thus,
game-playing must deal with contingency problems
7
Kind of Games
8
Kind of Games
A game can be formally defined as a kind of search problem with
the following elements:
• Player(s) ?
• Actions(s) ?
• Result(s, a) ?
• Terminal-test ?
9
Optimal Decisions in Game
• In a normal search problem, the optimal solution would be a
sequence of actions leading to a goal state
11
Minimax Strategy
• Considering two-player, take turns and try respectively to
maximize and minimize a scoring function and called MAX and
MIN
12
Minimax Strategy
• The Minimax game strategy for the MAX (MIN) player is to
select the move that leads to the successor node with the
highest (lowest) score.
13
Minimax Strategy
• Basic Idea: choose move with highest minimax value
= best achievable payoff against best play
• Algorithm:
14
Minimax Strategy
15
Game Tree
16
Minimax Strategy
• Example: Generate game tree
17
Minimax Strategy
• Example: Generate game tree
18
Minimax Strategy
• Example: Generate game tree
19
Minimax Strategy
• Example: Generate game tree
20
Minimax Strategy
• Example: A sub tree of a game tree
21
Minimax Strategy
• What is a good move?
22
Alpha-Beta Pruning
• Pruning: eliminating a branch of the search tree from
consideration without exhaustive examination of each node
23
Alpha-Beta Pruning
6
MAX
MIN 6
= highest value
= lowest value
6 12 8
24
Alpha-Beta Pruning
6
MAX
MIN 6 2
MIN 6 2 5
6 12 8 2 14
26
Alpha-Beta Pruning
27
Alpha-Beta Pruning
28
Alpha-Beta Pruning
MAX 6
Selected
move
MIN 6 2 5
6 12 8 2 14 5 8
29
Imperfect Real-Time Decisions
• Complete search is too complex and impractical
e.g.
w’s could be the values of pieces (1 for prawn, 3 for bishop
etc.)
f’s could be the number of type of pieces on the board 31
Imperfect Real-Time Decisions
Value
10
9
5
3
3
1
32
References
• Stuart Russell, Peter Norvig. 2010. Artificial Intelligence : A
Modern Approach. Pearson Education. New Jersey.
ISBN:9780132071482
33
Exercise
34
Exercise
Given a Min-Max tree as below, describe in your own figure how the
process of Alpha-Beta Pruning is executed to the tree!
MAX
MIN
MAX
5 3 7 1 8 2 1 4 9 5 6 3 8 1
35