SlideShare a Scribd company logo
1 of 21
Adversarial Search 
Chapter 6 
Section 1 – 4
Outline 
• Optimal decisions 
• α-β pruning 
• Imperfect, real-time decisions
Games vs. search problems 
• "Unpredictable" opponent  specifying a 
move for every possible opponent reply 
• Time limits  unlikely to find goal, must 
approximate 
• 
•
Game tree (2-player, 
deterministic, turns)
Minimax 
• Perfect play for deterministic games 
• Idea: choose move to position with highest minimax 
value 
= best achievable payoff against best play 
• E.g., 2-ply game: 
• 
• 
•
Minimax algorithm
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 
• 
• 
• 
•
α-β pruning example
α-β pruning example
α-β pruning example
α-β pruning example
α-β pruning example
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 
• A simple example of the value of reasoning about which 
computations are relevant (a form of metareasoning) 
»» 
•
Why is it called α-β? 
• α is the value of the 
best (i.e., highest-value) 
choice found 
so far at any choice 
point along the path 
for max 
• If v is worse than α, 
max will avoid it 
 prune that branch 
• Define β similarly for 
min 
» 
–
The α-β algorithm
The α-β algorithm
Resource limits 
Suppose we have 100 secs, explore 104 nodes/sec 
 106 nodes per move 
Standard approach: 
• cutoff test: 
e.g., depth limit (perhaps add quiescence search) 
• evaluation function 
= estimated desirability of position 
– 
–
Evaluation functions 
• For chess, typically linear weighted sum of features 
Eval(s) = w1 f1(s) + w2 f2(s) + … + wn fn(s) 
• e.g., w1 = 9 with 
f1(s) = (number of white queens) – (number of black 
queens), etc. 
•
Cutting off search 
MinimaxCutoff is identical to MinimaxValue except 
1. Terminal? is replaced by Cutoff? 
2. Utility is replaced by Eval 
Does it work in practice? 
bm = 106, b=35  m=4 
4-ply lookahead is a hopeless chess player! 
– 4-ply ≈ human novice 
– 8-ply ≈ typical PC, human master 
– 12-ply ≈ Deep Blue, Kasparov 
– 
•
Deterministic games in practice 
• Checkers: Chinook ended 40-year-reign of human world champion 
Marion Tinsley in 1994. Used a precomputed endgame database 
defining perfect play for all positions involving 8 or fewer pieces on 
the board, a total of 444 billion positions. 
» 
• Chess: Deep Blue defeated human world champion Garry Kasparov 
in a six-game match in 1997. Deep Blue searches 200 million 
positions per second, uses very sophisticated evaluation, and 
undisclosed methods for extending some lines of search up to 40 
ply. 
• Othello: human champions refuse to compete against computers, 
who are too good. 
• Go: human champions refuse to compete against computers, who 
are too bad. In go, b > 300, so most programs use pattern 
knowledge bases to suggest plausible moves. 
»»»
Summary 
• Games are fun to work on! 
• They illustrate several important points 
about AI 
• perfection is unattainable  must 
approximate 
• good idea to think about what to think 
about 
• 
•

More Related Content

Similar to Adversarial Search and Pruning Techniques

GamePlaying.ppt
GamePlaying.pptGamePlaying.ppt
GamePlaying.pptVihaanN2
 
CptS 440/ 540 AI.pptx
CptS 440/ 540 AI.pptxCptS 440/ 540 AI.pptx
CptS 440/ 540 AI.pptxDrDejaVu2
 
chess-algorithms-theory-and-practice_ver2017.pdf
chess-algorithms-theory-and-practice_ver2017.pdfchess-algorithms-theory-and-practice_ver2017.pdf
chess-algorithms-theory-and-practice_ver2017.pdfrajdipdas12
 
Adversarial search with Game Playing
Adversarial search with Game PlayingAdversarial search with Game Playing
Adversarial search with Game PlayingAman Patel
 
It is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicsIt is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicschougulesup79
 
Game playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graphGame playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graphSyed Zaid Irshad
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptSabrinaShanta2
 
ch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.pptch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.pptSanGeet25
 
Chess Engine Programming
Chess Engine ProgrammingChess Engine Programming
Chess Engine ProgrammingArno Huetter
 
Playing Go with Clojure
Playing Go with ClojurePlaying Go with Clojure
Playing Go with Clojureztellman
 

Similar to Adversarial Search and Pruning Techniques (20)

GamePlaying.ppt
GamePlaying.pptGamePlaying.ppt
GamePlaying.ppt
 
Games
GamesGames
Games
 
Games.4
Games.4Games.4
Games.4
 
CptS 440/ 540 AI.pptx
CptS 440/ 540 AI.pptxCptS 440/ 540 AI.pptx
CptS 440/ 540 AI.pptx
 
l3.pptx
l3.pptxl3.pptx
l3.pptx
 
chess-algorithms-theory-and-practice_ver2017.pdf
chess-algorithms-theory-and-practice_ver2017.pdfchess-algorithms-theory-and-practice_ver2017.pdf
chess-algorithms-theory-and-practice_ver2017.pdf
 
Adversarial search with Game Playing
Adversarial search with Game PlayingAdversarial search with Game Playing
Adversarial search with Game Playing
 
cai
caicai
cai
 
Game playing.ppt
Game playing.pptGame playing.ppt
Game playing.ppt
 
It is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topicsIt is an artificial document, please. regarding Ai topics
It is an artificial document, please. regarding Ai topics
 
Game playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graphGame playing (tic tac-toe), andor graph
Game playing (tic tac-toe), andor graph
 
484-7.ppt
484-7.ppt484-7.ppt
484-7.ppt
 
Topic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).pptTopic - 6 (Game Playing).ppt
Topic - 6 (Game Playing).ppt
 
ch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.pptch_5 Game playing Min max and Alpha Beta pruning.ppt
ch_5 Game playing Min max and Alpha Beta pruning.ppt
 
Two player games
Two player gamesTwo player games
Two player games
 
Chess Engine Programming
Chess Engine ProgrammingChess Engine Programming
Chess Engine Programming
 
Playing Go with Clojure
Playing Go with ClojurePlaying Go with Clojure
Playing Go with Clojure
 
chess-180927202627.pdf
chess-180927202627.pdfchess-180927202627.pdf
chess-180927202627.pdf
 
Capgemini 1
Capgemini 1Capgemini 1
Capgemini 1
 
AI Lecture 5 (game playing)
AI Lecture 5 (game playing)AI Lecture 5 (game playing)
AI Lecture 5 (game playing)
 

More from Yasir Khan (20)

Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lec#1
Lec#1Lec#1
Lec#1
 
Ch10 (1)
Ch10 (1)Ch10 (1)
Ch10 (1)
 
Ch09
Ch09Ch09
Ch09
 
Ch05
Ch05Ch05
Ch05
 
Snooping protocols 3
Snooping protocols 3Snooping protocols 3
Snooping protocols 3
 
Snooping 2
Snooping 2Snooping 2
Snooping 2
 
Introduction 1
Introduction 1Introduction 1
Introduction 1
 
Hpc sys
Hpc sysHpc sys
Hpc sys
 
Hpc 4 5
Hpc 4 5Hpc 4 5
Hpc 4 5
 
Hpc 3
Hpc 3Hpc 3
Hpc 3
 
Hpc 2
Hpc 2Hpc 2
Hpc 2
 
Hpc 1
Hpc 1Hpc 1
Hpc 1
 
Flynns classification
Flynns classificationFlynns classification
Flynns classification
 
Dir based imp_5
Dir based imp_5Dir based imp_5
Dir based imp_5
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Uncertainity
Uncertainity Uncertainity
Uncertainity
 

Adversarial Search and Pruning Techniques

  • 1. Adversarial Search Chapter 6 Section 1 – 4
  • 2. Outline • Optimal decisions • α-β pruning • Imperfect, real-time decisions
  • 3. Games vs. search problems • "Unpredictable" opponent  specifying a move for every possible opponent reply • Time limits  unlikely to find goal, must approximate • •
  • 4. Game tree (2-player, deterministic, turns)
  • 5. Minimax • Perfect play for deterministic games • Idea: choose move to position with highest minimax value = best achievable payoff against best play • E.g., 2-ply game: • • •
  • 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 • • • •
  • 13. 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 • A simple example of the value of reasoning about which computations are relevant (a form of metareasoning) »» •
  • 14. Why is it called α-β? • α is the value of the best (i.e., highest-value) choice found so far at any choice point along the path for max • If v is worse than α, max will avoid it  prune that branch • Define β similarly for min » –
  • 17. Resource limits Suppose we have 100 secs, explore 104 nodes/sec  106 nodes per move Standard approach: • cutoff test: e.g., depth limit (perhaps add quiescence search) • evaluation function = estimated desirability of position – –
  • 18. Evaluation functions • For chess, typically linear weighted sum of features Eval(s) = w1 f1(s) + w2 f2(s) + … + wn fn(s) • e.g., w1 = 9 with f1(s) = (number of white queens) – (number of black queens), etc. •
  • 19. Cutting off search MinimaxCutoff is identical to MinimaxValue except 1. Terminal? is replaced by Cutoff? 2. Utility is replaced by Eval Does it work in practice? bm = 106, b=35  m=4 4-ply lookahead is a hopeless chess player! – 4-ply ≈ human novice – 8-ply ≈ typical PC, human master – 12-ply ≈ Deep Blue, Kasparov – •
  • 20. Deterministic games in practice • Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in 1994. Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions. » • Chess: Deep Blue defeated human world champion Garry Kasparov in a six-game match in 1997. Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply. • Othello: human champions refuse to compete against computers, who are too good. • Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves. »»»
  • 21. Summary • Games are fun to work on! • They illustrate several important points about AI • perfection is unattainable  must approximate • good idea to think about what to think about • •