Game-playing AIs Part 2 CIS 391 Fall 2007. CSE 391 - Intro to AI 2 Games: Outline of Unit Part II  The Minimax Rule  Alpha-Beta Pruning  Game-playing.

Slides:



Advertisements
Similar presentations
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Advertisements

Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
For Friday Finish chapter 5 Program 1, Milestone 1 due.
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.
CS 484 – Artificial Intelligence
1 Game Playing. 2 Outline Perfect Play Resource Limits Alpha-Beta pruning Games of Chance.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
Search Strategies.  Tries – for word searchers, spell checking, spelling corrections  Digital Search Trees – for searching for frequent keys (in text,
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
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.
CMSC 463 Chapter 5: Game Playing Prof. Adam Anthony.
This time: Outline Game playing The minimax algorithm
Lecture 02 – Part C Game Playing: Adversarial Search
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
Game Playing CSC361 AI CSC361: Game Playing.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Adversarial Search: Game Playing Reading: Chess paper.
Games & Adversarial Search Chapter 6 Section 1 – 4.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
Game Playing State-of-the-Art  Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used an endgame database defining.
CSC 412: AI Adversarial Search
CHAPTER 6 : ADVERSARIAL SEARCH
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Notes adapted from lecture notes for CMSC 421 by B.J. Dorr
Adversarial Search Chapter 5 Adapted from Tom Lenaerts’ lecture notes.
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
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.
AD FOR GAMES Lecture 4. M INIMAX AND A LPHA -B ETA R EDUCTION Borrows from Spring 2006 CS 440 Lecture Slides.
Games CPS 170 Ron Parr. Why Study Games? Many human activities can be modeled as games –Negotiations –Bidding –TCP/IP –Military confrontations –Pursuit/Evasion.
1 Computer Group Engineering Department University of Science and Culture S. H. Davarpanah
Chapter 6 Adversarial Search. Adversarial Search Problem Initial State Initial State Successor Function Successor Function Terminal Test Terminal Test.
Adversarial Search CS311 David Kauchak Spring 2013 Some material borrowed from : Sara Owsley Sood and others.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Notes on Game Playing by Yun Peng of theYun Peng University of Maryland Baltimore County.
For Wednesday Read Weiss, chapter 12, section 2 Homework: –Weiss, chapter 10, exercise 36 Program 5 due.
Minimax with Alpha Beta Pruning The minimax algorithm is a way of finding an optimal move in a two player game. Alpha-beta pruning is a way of finding.
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.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
CSE373: Data Structures & Algorithms Lecture 23: Intro to Artificial Intelligence and Game Theory Based on slides adapted Luke Zettlemoyer, Dan Klein,
Game-Playing & Adversarial Search Alpha-Beta Pruning, etc. This lecture topic: Game-Playing & Adversarial Search (Alpha-Beta Pruning, etc.) Read Chapter.
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Game Playing: Adversarial Search chapter 5. Game Playing: Adversarial Search  Introduction  So far, in problem solving, single agent search  The machine.
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.
Games: Efficiency Andrea Danyluk September 23, 2013.
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 Chapter 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Chapter 5: Adversarial Search & Game Playing
ADVERSARIAL SEARCH Chapter 6 Section 1 – 4. OUTLINE Optimal decisions α-β pruning Imperfect, real-time decisions.
Adversarial Search CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and Java.
Game Playing: Adversarial Search
Game Playing: Adversarial Search
Game Playing Chapter 5.
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Presentation transcript:

Game-playing AIs Part 2 CIS 391 Fall 2007

CSE Intro to AI 2 Games: Outline of Unit Part II  The Minimax Rule  Alpha-Beta Pruning  Game-playing AI successes

CSE Intro to AI 3 `Don’t play hope chess’: The Minimax Rule Idea: make the move for player MAX which has the most benefit assuming that MIN makes the best move for MIN in response This is computed by a recursive process The backed-up value of each node in the tree is determined by the values of its children For a MAX node, the backed-up value is the maximum of the values of its children (i.e. the best for MAX) For a MIN node, the backed-up value is the minimum of the values of its children (i.e. the best for MIN)

CSE Intro to AI 4 The Minimax Procedure 1.Start with the current position as a MAX node. 2.Expand the game tree a fixed number of ply (half-moves). 3.Apply the evaluation function to the leaf positions. 4.Calculate back-up up values bottom-up. 5.Pick the move which was chosen to give the MAX value at the root.

CSE Intro to AI 5 2-ply Minimax Example MAX MIN This is the move selected by minimax Evaluation function value

CSE Intro to AI 6 What if MIN does not play optimally?  Definition of optimal play for MAX assumes MIN plays optimally: maximizes worst-case outcome for MAX.  But if MIN does not play optimally, MAX will do even better. [Theorem-not hard to prove]

CSE Intro to AI 7 Minimax Algorithm function MINIMAX-DECISION(state) returns an action inputs: state, current state in game v  MAX-VALUE(state) return the action in SUCCESSORS(state) with value v function MIN-VALUE(state) returns a utility value if TERMINAL-TEST(state) then return UTILITY(state) v  ∞ for a,s in SUCCESSORS(state) do v  MIN(v, MAX-VALUE(s) ) return v function MAX-VALUE(state) returns a utility value if TERMINAL-TEST(state) then return UTILITY(state) v  -∞ for a,s in SUCCESSORS(state) do v  MAX(v, MIN-VALUE(s) ) return v

CSE Intro to AI 8 Comments on Minimax Search  Depth-first search with fixed number of ply as the limit. O(b m ) time complexity – Ooops! O(bm) space complexity  Performance will depend on the quality of the evaluation function (expert knowledge) depth of search (computing power and search algorithm)  Differences from normal state space search Looking for one move only No cost on arcs MAX can’t be sure how MIN will respond to his moves  Minimax rule forms the basis for other game tree search algorithms.

Alpha-Beta Pruning Slides of example from screenshots by Mikael Bodén, Halmstad University, Sweden found at

CSE Intro to AI 10 Alpha-Beta Pruning  A way to improve the performance of the Minimax Procedure  Basic idea: “If you have an idea which is surely bad, don’t take the time to see how truly awful it is” ~ Pat Winston 271 =2 >=2 <=1 ? We don’t need to compute the value at this node. No matter what it is it can’t effect the value of the root node.

CSE Intro to AI 11  The algorithm maintains two values, alpha and beta, which represent the minimum score that the maximizing player is assured of and the maximum score that the minimizing player is assured of respectively. Initially alpha is negative infinity and beta is positive infinity. As the recursion progresses the "window" becomes smaller. When beta becomes less than alpha, it means that the current position cannot be the result of best play by both players and hence need not be explored further.

CSE Intro to AI 12  An alpha value is an initial or temporary value associated with a MAX node. Because MAX nodes are given the maximum value among their children, an alpha value can never decrease; it can only go up. A beta value is an initial or temporary value associated with a MIN node. Because MIN nodes are given the minimum value among their children, a beta value can never increase; it can only go down.

CSE Intro to AI 13  /G13GAM/alphabet.html /G13GAM/alphabet.html

CSE Intro to AI 14 Alpha-Beta Pruning  Traverse the search tree in depth-first order  For each MAX node n, α(n)=maximum child value found so far Starts with –  Increases if a child returns a value greater than the current α(n) Lower-bound on the final value  For each MIN node n, β(n)=minimum child value found so far Starts with +  Decreases if a child returns a value less than the current β(n) Upper-bound on the final value  MAX cutoff rule: At a MAX node n, cut off search if α(n)>=β(n)  MIN cutoff rule: At a MIN node n, cut off search if β(n)<=α(n)  Carry α and β values down in search

CSE Intro to AI 15

CSE Intro to AI 16

CSE Intro to AI 17

CSE Intro to AI 18

CSE Intro to AI 19

CSE Intro to AI 20

CSE Intro to AI 21

CSE Intro to AI 22

CSE Intro to AI 23

CSE Intro to AI 24

CSE Intro to AI 25

CSE Intro to AI 26

CSE Intro to AI 27

CSE Intro to AI 28

CSE Intro to AI 29

CSE Intro to AI 30

CSE Intro to AI 31

CSE Intro to AI 32

CSE Intro to AI 33 Alpha-Beta Algorithm I function ALPHA-BETA-SEARCH(state) returns an action inputs: state, current state in game v  MAX-VALUE(state, - ∞, + ∞ ) return the action in SUCCESSORS(state) with value v function MAX-VALUE(state, ,  ) returns a utility value if TERMINAL-TEST(state) then return UTILITY(state) v  - ∞ for a,s in SUCCESSORS(state) do v  MAX(v,MIN-VALUE(s, ,  )) if v ≥  then return v   MAX( ,v) return v

CSE Intro to AI 34 Alpha-Beta Algorithm II function MIN-VALUE(state, ,  ) returns a utility value if TERMINAL-TEST(state) then return UTILITY(state) v  + ∞ for a,s in SUCCESSORS(state) do v  MIN(v,MAX-VALUE(s, ,  )) if v ≤  then return v   MIN( ,v) return v

CSE Intro to AI 35 Effectiveness of Alpha-Beta Pruning  Guaranteed to compute same root value as Minimax  Worst case: no pruning, same as Minimax (O(b d ))  Best case: when each player’s best move is the first option examined, you examine only O(b d/2 ) nodes, allowing you to search twice as deep!  For Deep Blue, alpha-beta pruning reduced the average branching factor from to 6.

CSE Intro to AI 36 Chinook and Deep Blue  Chinook the World Man-Made Checkers Champion, developed at the University of Alberta. Competed in human tournaments, earning the right to play for the human world championship, and defeated the best players in the world. Play Chinook at  Deep Blue Defeated world champion Gary Kasparov in 1997 after losing 4-2 in Uses a parallel array of 256 special chess-specific processors Evaluates 200 billion moves every 3 minutes; 12-ply search depth Expert knowledge from an international grandmaster factor evaluation function tuned from hundreds of thousands of grandmaster games Tends to play for tiny positional advantages.