Adversarial Search and Game Playing

Slides:



Advertisements
Similar presentations
Game Playing CS 63 Chapter 6
Advertisements

Game playing.
Game playing. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
CMSC 671 Fall 2001 Class #8 – Thursday, September 27.
1 CSC 550: Introduction to Artificial Intelligence Fall 2008 search in game playing  zero-sum games  game trees, minimax principle  alpha-beta pruning.
Adversarial Search: Game Playing Reading: Chapter next time.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
A DVERSARIAL S EARCH & G AME P LAYING. 2 3 T EXAS H OLD ‘E M P OKER 2 cards per player, face down 5 community cards dealt incrementally Winner has best.
Game Playing CSC361 AI CSC361: Game Playing.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
Game-Playing Read Chapter 6 Adversarial Search. Game Types Two-person games vs multi-person –chess vs monopoly Perfect Information vs Imperfect –checkers.
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Adversarial Search and Game Playing Examples. Game Tree MAX’s play  MIN’s play  Terminal state (win for MAX)  Here, symmetries have been used to reduce.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game-Playing Read Chapter 6 Adversarial Search. State-Space Model Modified States the same Operators depend on whose turn Goal: As before: win or win.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
ICS-270a:Notes 5: 1 Notes 5: Game-Playing ICS 270a Winter 2003.
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
CSC 412: AI Adversarial Search
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Game Playing: Adversarial Search Dr. Yousef Al-Ohali Computer Science Depart. CCIS – King Saud University Saudi Arabia
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Chapter 12 Adversarial Search. (c) 2000, 2001 SNU CSE Biointelligence Lab2 Two-Agent Games (1) Idealized Setting  The actions of the agents are interleaved.
Notes on Game Playing by Yun Peng of theYun Peng University of Maryland Baltimore County.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.
Adversarial Search; Heuristics in Games Foundations of Artificial Intelligence.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search Adversarial Search (game playing search) We have experience in search where we assume that we are the only intelligent being and we.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Offer an opportunity to study problems involving {hostile,
Adversarial Search 2 (Game Playing)
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
Adversarial Search and Game Playing Russell and Norvig: Chapter 5 Russell and Norvig: Chapter 6 CS121 – Winter 2003.
Adversarial Search and Game Playing. Topics Game playing Game trees Minimax Alpha-beta pruning Examples.
Adversarial Search Chapter Two-Agent Games (1) Idealized Setting – The actions of the agents are interleaved. Example – Grid-Space World – Two.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Adversarial Search Aka Games
More on Games Chapter 6 Some material adopted from notes by Charles R. Dyer, University of Wisconsin-Madison.
Iterative Deepening A*
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
PENGANTAR INTELIJENSIA BUATAN (64A614)
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Game Playing in AI by: Gaurav Phapale 05 IT 6010
Games & Adversarial Search
Artificial Intelligence
Games & Adversarial Search
CMSC 471 Fall 2011 Class #8-9 Tue 9/27/11 – Thu 9/29/11 Game Playing
Artificial Intelligence Chapter 12 Adversarial Search
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Games & Adversarial Search
Games & Adversarial Search
Game Playing: Adversarial Search
Game Playing: Adversarial Search
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Game Playing: Adversarial Search
Artificial Intelligence
Game Playing Chapter 5.
Adversarial Search and Game Playing Examples
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Unit II Game Playing.
Presentation transcript:

Adversarial Search and Game Playing Russell and Norvig: Chapter 5 Russell and Norvig: Chapter 6 CS121 – Winter 2003 Adversarial Search and Game Playing

Adversarial Search and Game Playing Game-Playing Agent environment agent ? sensors actuators Environment Adversarial Search and Game Playing

Perfect Two-Player Game Two players MAX and MIN take turn (with MAX playing first) State space Initial state Successor function Terminal test Score function, that tells whether a terminal state is a win (for MAX), a loss, or a draw Perfect knowledge of states, no uncertainty in successor function Adversarial Search and Game Playing

Example: Grundy’s Game Initial state: a stack of 7 coins State: a set of stacks Successor function: Break one stack of coins into two unequal stacks Terminal state: All stacks contain one or two coins Score function: terminal state is a win for MAX if it was generated by MAX, and a loss otherwise Adversarial Search and Game Playing

Adversarial Search and Game Playing Game Graph/Tree +1 -1 Adversarial Search and Game Playing

Partial Tree for Tic-Tac-Toe Adversarial Search and Game Playing

Uncertainty in Action Model Adversarial Search and Game Playing

Uncertainty in Action Model ? Make the best decision assuming the worst-case outcome of each action Adversarial Search and Game Playing

Adversarial Search and Game Playing AND/OR Tree Adversarial Search and Game Playing

Labeling of AND/OR Tree Adversarial Search and Game Playing

Example: Grundy’s Game -1 -1 -1 -1 +1 -1 -1 +1 +1 -1 +1 -1 +1 Adversarial Search and Game Playing

Adversarial Search and Game Playing But in general the search tree is too big to make it possible to reach the terminal states! Adversarial Search and Game Playing

Adversarial Search and Game Playing But in general the search tree is too big to make it possible to reach the terminal states! Examples: Checkers: ~1040 nodes Chess: ~10120 nodes Adversarial Search and Game Playing

Evaluation Function of a State e(s) = + if s is a win for MAX e(s) = - if s is a win for MIN e(s) = a measure of how “favorable” is s for MAX > 0 if s is considered favorable to MAX < 0 otherwise Adversarial Search and Game Playing

Adversarial Search and Game Playing Example: Tic-Tac-Toe e(s) = number of rows, columns, and diagonals open for MAX - number of rows, columns, and diagonals open for MIN 8-8 = 0 6-4 = 2 3-3 = 0 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example Tic-Tac-Toe with horizon = 2 1 -1 1 -2 6-5=1 5-6=-1 5-5=0 5-5=1 4-5=-1 6-4=2 5-4=1 6-6=0 4-6=-2 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example 1 1 1 3 2 1 2 1 2 3 1 1 Adversarial Search and Game Playing

Adversarial Search and Game Playing Minimax procedure Expand the game tree uniformly from the current state (where it is MAX’s turn to play) to depth h Compute the evaluation function at every leaf of the tree Back-up the values from the leaves to the root of the tree as follows: A MAX node gets the maximum of the evaluation of its successors A MIN node gets the minimum of the evaluation of its successors Select the move toward the MIN node that has the maximal backed-up value Horizon of the procedure Needed to limit the size of the tree or to return a decision within allowed time Adversarial Search and Game Playing

Adversarial Search and Game Playing Game Playing (for MAX) Repeat until win, lose, or draw Select move using Minimax procedure Execute move Observe MIN’s move Adversarial Search and Game Playing

Adversarial Search and Game Playing Issues Choice of the horizon Size of memory needed Number of nodes examined Adversarial Search and Game Playing

Adversarial Search and Game Playing Adaptive horizon Wait for quiescence Extend singular nodes /Secondary search Note that the horizon may not then be the same on every path of the tree Adversarial Search and Game Playing

Adversarial Search and Game Playing Issues Choice of the horizon Size of memory needed Number of nodes examined Adversarial Search and Game Playing

Adversarial Search and Game Playing Alpha-Beta Procedure Generate the game tree to depth h in depth-first manner Back-up estimates (alpha and beta values) of the evaluation functions whenever possible Prune branches that cannot lead to changing the final decision Adversarial Search and Game Playing

Adversarial Search and Game Playing Example Adversarial Search and Game Playing

Adversarial Search and Game Playing Example The beta value of a MIN node is a higher bound on the final backed-up value. It can never increase b = 1 1 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example b = 0 The beta value of a MIN node is a higher bound on the final backed-up value. It can never increase 1 1 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example b = -1 The beta value of a MIN node is a higher bound on the final backed-up value. It can never increase 1 -1 1 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example a = -1 b = -1 The alpha value of a MAX node is a lower bound on the final backed-up value. It can never decrease 1 -1 1 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example a = -1 b = -1 1 -1 1 Adversarial Search and Game Playing

Adversarial Search and Game Playing Example a = -1 b = -1 b = -1 1 1 -1 -1 Search can be discontinued below any MIN node whose beta value is less than or equal to the alpha value of one of its MAX ancestors Adversarial Search and Game Playing

Adversarial Search and Game Playing Alpha-Beta Example 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example -3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example -3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example -3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 3 -3 3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 3 -3 3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 3 -3 3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 3 -3 3 5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 3 2 -3 3 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 3 2 -3 3 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 -3 3 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 -3 3 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 -3 3 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 -3 3 2 5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 1 -3 3 2 1 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 1 -3 3 2 1 -3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 2 3 2 1 -3 3 2 1 -3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 1 2 1 3 2 1 -3 3 2 1 -3 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 1 2 1 3 2 1 -3 3 2 1 -3 -5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 1 2 1 3 2 1 -3 3 2 1 -3 -5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 1 2 1 -5 3 2 1 -5 -3 3 2 1 -3 -5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 2 1 2 1 -5 3 2 1 -5 -3 3 2 1 -3 -5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 1 1 2 1 2 1 -5 3 2 1 -5 -3 3 2 1 -3 -5 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 1 1 2 1 2 2 1 -5 2 3 2 1 -5 2 -3 3 2 1 -3 -5 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing Alpha-Beta Example 1 1 2 1 2 2 1 -5 2 3 2 1 -5 2 -3 3 2 1 -3 -5 2 5 -3 3 3 -3 Adversarial Search and Game Playing 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2

Adversarial Search and Game Playing How Much Do We Gain? 1 Size of tree = O(bh) In the worst case all nodes must be examined In the best case, only O(bh/2) nodes need to be examined 1 2 1 2 2 1 -5 2 3 2 1 -5 2 Exercise: In which order should the node be examined in order to achieve the best gain? -3 3 2 1 -3 -5 2 5 -3 3 3 -3 2 -2 3 5 2 5 -5 1 5 1 -3 -5 5 -3 3 2 Adversarial Search and Game Playing

Adversarial Search and Game Playing Alpha-Beta Procedure The alpha of a MAX node is a lower bound on the backed-up value The beta of a MIN node is a higher bound on the backed-up value Update the alpha/beta of the parent of a node N when all search below N has been completed or discontinued Adversarial Search and Game Playing

Adversarial Search and Game Playing Alpha-Beta Procedure The alpha of a MAX node is a lower bound on the backed-up value The beta of a MIN node is a higher bound on the backed-up value Update the alpha/beta of the parent of a node N when all search below N has been completed or discontinued Discontinue the search below a MAX node N if its alpha is  beta of a MIN ancestor of N Discontinue the search below a MIN node N if its beta is  alpha of a MAX ancestor of N Adversarial Search and Game Playing

Adversarial Search and Game Playing Alpha-Beta + … Iterative deepening Singular extensions Adversarial Search and Game Playing

Adversarial Search and Game Playing Checkers Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Chinook vs. Tinsley Name: Marion Tinsley Profession: Teach mathematics Hobby: Checkers Record: Over 42 years loses only 3 (!) games of checkers Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Chinook First computer to win human world championship! Adversarial Search and Game Playing

Adversarial Search and Game Playing Chess Adversarial Search and Game Playing

Adversarial Search and Game Playing Man vs. Machine Kasparov 5’10” 176 lbs 34 years 50 billion neurons 2 pos/sec Extensive Electrical/chemical Enormous Deep Blue 6’ 5” 2,400 lbs 4 years 512 processors 200,000,000 pos/sec Primitive Electrical None Name Height Weight Age Computers Speed Knowledge Power Source Ego Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Reversi/Othello Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Othello Name: Takeshi Murakami Title: World Othello Champion Crime: Man crushed by machine Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Go: On the One Side Name: Chen Zhixing Author: Handtalk (Goemate) Profession: Retired Computer skills: self- taught assembly language programmer Accomplishments: dominated computer go for 4 years. Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Go: And on the Other Gave Handtalk a 9 stone handicap and still easily beat the program, thereby winning $15,000 Adversarial Search and Game Playing © Jonathan Schaeffer

Perspective on Games: Pro “Saying Deep Blue doesn’t really think about chess is like saying an airplane doesn't really fly because it doesn't flap its wings” Drew McDermott Adversarial Search and Game Playing © Jonathan Schaeffer

Perspective on Games: Con “Chess is the Drosophila of artificial intelligence. However, computer chess has developed much as genetics might have if the geneticists had concentrated their efforts starting in 1910 on breeding racing Drosophila. We would have some science, but mainly we would have very fast fruit flies.” John McCarthy Adversarial Search and Game Playing © Jonathan Schaeffer

Adversarial Search and Game Playing Other Games Multi-player games, with alliances or not Games with randomness in successor function (e.g., rolling a dice) Incompletely known states (e.g., card games) Adversarial Search and Game Playing

Adversarial Search and Game Playing Summary Two-players game as a domain where action models are uncertain Optimal decision in the worst case Game tree Evaluation function / backed-up value Minimax procedure Alpha-beta procedure Adversarial Search and Game Playing