Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.

Slides:



Advertisements
Similar presentations
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Advertisements

Game playing. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Games & Adversarial Search
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
CMSC 671 Fall 2001 Class #8 – Thursday, September 27.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
1 CSC 550: Introduction to Artificial Intelligence Fall 2008 search in game playing  zero-sum games  game trees, minimax principle  alpha-beta pruning.
Game Playing Games require different search procedures. Basically they are based on generate and test philosophy. At one end, generator generates entire.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
COMP-4640: Intelligent & Interactive Systems Game Playing A game can be formally defined as a search problem with: -An initial state -a set of operators.
Adversarial Search: Game Playing Reading: Chapter next time.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Adversarial Search Board games. Games 2 player zero-sum games Utility values at end of game – equal and opposite Games that are easy to represent Chess.
CMSC 463 Chapter 5: Game Playing Prof. Adam Anthony.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
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.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Game Tree Search based on Russ Greiner and Jean-Claude Latombe’s notes.
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.
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
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
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
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.
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.
1 Computer Group Engineering Department University of Science and Culture S. H. Davarpanah
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
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.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
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.
Game-playing AIs Part 2 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part II  The Minimax Rule  Alpha-Beta Pruning  Game-playing.
Adversarial Search 2 (Game Playing)
Adversarial Search and Game Playing Russell and Norvig: Chapter 5 Russell and Norvig: Chapter 6 CS121 – Winter 2003.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Adversarial Search In this lecture, we introduce a new search scenario: game playing 1.two players, 2.zero-sum game, (win-lose, lose-win, draw) 3.perfect.
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.
Adversarial Search and Game-Playing
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.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Adversarial Search and Game Playing
Game Playing: Adversarial Search
Game Playing Chapter 5.
Adversarial Search and Game Playing Examples
Adversarial Search CS 171/271 (Chapter 6)
Presentation transcript:

Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang Lin. CS121 – Winter 2004

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

Partial Tree for Tic-Tac-Toe

But in general the search tree is too big to make it possible to reach the terminal states!

But in general the search tree is too big to make it possible to reach the terminal states! Examples: Checkers: ~10 40 nodes Chess: ~ nodes

Evaluation Functionof a State 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

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 = 06-4 = = 0

Example 6-5=1 5-6=-15-5=0 6-5=15-5=14-5=-1 5-6=-1 6-4=25-4=1 6-6=04-6= Tic-Tac-Toe with horizon = 2

Example

Minimax procedure 1.Expand the game tree uniformly from the current state (where it is MAX’s turn to play) to depth h 2.Compute the evaluation function at every leaf of the tree 3.Back-up the values from the leaves to the root of the tree as follows: 1.A MAX node gets the maximum of the evaluation of its successors 2.A MIN node gets the minimum of the evaluation of its successors 4.Select the move toward the MIN node that has the maximal backed-up value

Minimax procedure 1.Expand the game tree uniformly from the current state (where it is MAX’s turn to play) to depth h 2.Compute the evaluation function at every leaf of the tree 3.Back-up the values from the leaves to the root of the tree as follows: 1.A MAX node gets the maximum of the evaluation of its successors 2.A MIN node gets the minimum of the evaluation of its successors 4.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

Game Playing (for MAX) Repeat until win, lose, or draw 1. Select move using Minimax procedure 2. Execute move 3. Observe MIN’s move

Issues Choice of the horizon Size of memory needed Number of nodes examined

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

Issues Choice of the horizon Size of memory needed Number of nodes examined

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

Example

Example  1 The beta value of a MIN node is a higher bound on the final backed-up value. It can never increase

Example  1010 The beta value of a MIN node is a higher bound on the final backed-up value. It can never increase

Example  1010 The beta value of a MIN node is a higher bound on the final backed-up value. It can never increase

Example   1010 The alpha value of a MAX node is a lower bound on the final backed-up value. It can never decrease

Example   1010

Example   1010  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

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

Alpha-Beta Example min max min max min max

How Much Do We Gain? Size of tree = O(b h ) In the worst case all nodes must be examined In the best case, only O(b h/2 ) nodes need to be examined Exercise: In which order should the node be examined in order to achieve the best gain?

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

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

Alpha-Beta + … Iterative deepening Singular extensions

Checkers © Jonathan Schaeffer

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

Chinook First computer to win human world championship!

Chess

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

Reversi/Othello

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)

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