Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.

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.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CS 484 – Artificial Intelligence
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.
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.
Artificial Intelligence for Games Game playing Patrick Olivier
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.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
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.
Games and adversarial search
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)
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”
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
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
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.
KU NLP Heuristic Search Heuristic Search and Expert Systems (1) q An interesting approach to implementing heuristics is the use of confidence.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
Game Playing.
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.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
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.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
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.
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.
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)
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.
Search: Games & Adversarial Search Artificial Intelligence CMSC January 28, 2003.
Artificial Intelligence AIMA §5: Adversarial Search
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Games and Adversarial Search
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
Games & Adversarial Search
Game playing.
Alpha-Beta Search.
Games & Adversarial Search
Games & Adversarial Search
Alpha-Beta Search.
Alpha-Beta Search.
Alpha-Beta Search.
Mini-Max search Alpha-Beta pruning General concerns on games
Artificial Intelligence
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Presentation transcript:

Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games

2 Why study board games ?  One of the oldest subfields of AI (Shannon and Turing, 1950)  Abstract and pure form of competition that seems to require intelligence  Easy to represent the states and actions  Very little world knowledge required !  Game playing is a special case of a search problem, with some new requirements.

3 Types of games Bridge, poker, scrabble, nuclear war Backgammon, monopoly Chess, checkers, go, othello ChanceDeterministic Imperfect information Perfect information Sea battle

4 Why new techniques for games?  “Contingency” problem:  We don’t know the opponents move !  The size of the search space:  Chess : ~15 moves possible per state, 80 ply  nodes in tree  Go : ~200 moves per state, 300 ply  nodes in tree  Game playing algorithms:  Search tree only up to some depth bound  Use an evaluation function at the depth bound  Propagate the evaluation upwards in the tree

5 MINI MAX  Restrictions:  2 players: MAX (computer) and MIN (opponent)  deterministic, perfect information  Select a depth-bound (say: 2) and evaluation function MAX MIN MAX - Construct the tree up till the depth-bound the depth-bound - Compute the evaluation function for the leaves function for the leaves Propagate the evaluation function upwards: function upwards: - taking minima in MIN - taking minima in MIN taking maxima in MAX 3 Select this move

6 The MINI-MAX algorithm: Initialise depthbound; Minimax (board, depth) = IF depth = depthbound THEN return static_evaluation(board); THEN return static_evaluation(board); ELSE IF maximizing_level(depth) ELSE IF maximizing_level(depth) THEN FOR EACH child child of board THEN FOR EACH child child of board compute Minimax(child, depth+1); compute Minimax(child, depth+1); return maximum over all children; return maximum over all children; ELSE IF minimizing_level(depth) ELSE IF minimizing_level(depth) THEN FOR EACH child child of board THEN FOR EACH child child of board compute Minimax(child, depth+1); compute Minimax(child, depth+1); return minimum over all children; return minimum over all children; Call: Minimax(current_board, 0)

7 Alpha-Beta Cut-off  Generally applied optimization on Mini-max.  Instead of:  first creating the entire tree (up to depth-level)  then doing all propagation  Interleave the generation of the tree and the propagation of values.  Point:  some of the obtained values in the tree will provide information that other (non-generated) parts are redundant and do not need to be generated.

8 MIN MAXMAX2 Alpha-Beta idea:  Principles:  generate the tree depth-first, left-to-right  propagate final values of nodes as initial estimates for their parent node. 2222 5 =2 2222 1 1111 - The MIN-value (1) is already smaller than the MAX-value of the parent (2) - The MIN-value can only decrease further, decrease further, - The MAX-value is only allowed to increase, to increase, - No point in computing further below this node below this node

9 Terminology: - The (temporary) values at MAX-nodes are ALPHA-values - The (temporary) values at MIN-nodes are BETA-values MIN MAX MAX 2 2222 5 =2 2222 1 1111 Alpha-value Beta-value

10 The Alpha-Beta principles (1): - If an ALPHA-value is larger or equal than the Beta-value of a descendant node: stop generation of the children of the descendant MIN MAX MAX 2 2222 5 =2 2222 1 1111 Alpha-value Beta-value 

11 The Alpha-Beta principles (2): - If an Beta-value is smaller or equal than the Alpha-value of a descendant node: stop generation of the children of the descendant MIN MAX MAX 2 2222 5 =2 2222 3 1111 Alpha-value Beta-value 

Mini-Max with  at work: 1 2  8 8 8 83 5 =  8 8 8 87 8  9 9 9  2 2 2 2 12  4 4 4 4 14 = 4 15  4 4 4  1 1 1 1 20  3 3 3 3 22 = 5 30  5 5 5 523  5 5 5  3 3 3 3 27  9 9 9 9 29  6 6 6 6 33  1 1 1 1 35  2 2 2 2 37 = 3  3 3 3 = 5 MAX MIN MAX 11 static evaluations saved !!

13 “DEEP” cut-offs - For game trees with at least 4 Min/Max layers: the Alpha - Beta rules apply also to deeper levels. 4  4 4 4 4  4 4 4 4  4 4 4 4  4 4 4 4 2  2 2 2 2

14 The Gain: Best case: MAXMIN MAX - If at every layer: the best node is the left-most one Only THICK is explored

15 Example of a perfectly ordered tree MAXMIN MAX

16 # (static evaluations saved) = How much gain ? - Alpha / Beta : best case : 2 b d/2 - 1 (if d is even) b (d+1)/2 + b (d-1)/2 - 1 (if d is odd) - The proof is by induction. - In the running example: d=3, b=3 : 11 !

17 Best case gain pictured: # Static evaluations Depth No pruning b = 10 Alpha-Beta Best case - Note: algorithmic scale. - Conclusion: still exponential growth !! - Worst case?? For some trees alpha-beta does nothing, For some trees: impossible to reorder to avoid cut-offs

18 The horinzon effect. Queen lost Pawn lost Queen lost horizon = depth bound of mini-max Because of the depth-bound we prefer to delay disasters, although we don’t prevent them !! we prefer to delay disasters, although we don’t prevent them !!  solution: heuristic continuations

19 Heuristic Continuation In situations that are identifies as strategically crucial e.g: king in danger, imminent piece loss, pawn to become as queens,... extend the search beyond the depth-bound ! depth-bound

20 How to organize the continuations? How to control (and stop) extending the tree? Tapering search (or: heuristic pruning) Order the moves in 1 layer by quality. b(child) = b(parent) - (rank child among brothers) b =

21 Time bounds: How to play within reasonable time bounds? Even with fixed depth-bound, times can vary strongly! Solution: Iterative Deepening !!! Remember: overhead of previous searches = 1/b Good investment to be sure to have a move ready.

22 Games of chance Ex.: Backgammon: Form of the game tree:

23 “Utility” propagation with chances: Utility function for a Maximizing node C : MAX s1s2s3s4 d1 d2d3d4d5 S(C,d3) C Min