Minimax.

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

AI for Connect-4 (or other 2-player games) Minds and Machines.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
CS 484 – Artificial Intelligence
Presented by : Ashin Ara Bithi Roll : 09 Iffat Ara Roll : 22 12th Batch Department of Computer Science & Engineering University of Dhaka.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
Artificial Intelligence in Game Design
All rights reservedL. Manevitz Lecture 31 Artificial Intelligence A/O* and Minimax L. Manevitz.
This time: Outline Game playing The minimax algorithm
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
CS 561, Sessions Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first.
Game Playing CSC361 AI CSC361: Game Playing.
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
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)
1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Chap. 6 [AIMA] Chang-Sheng Chen.
CS 460, Sessions Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first.
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: Game Playing Reading: Chess paper.
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.
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
CISC 235: Topic 6 Game Trees.
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.
Game Playing. Introduction Why is game playing so interesting from an AI point of view? –Game Playing is harder then common searching The search space.
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.
Search CSE When you can’t use A* Hill-climbing Simulated Annealing Other strategies 2 person- games.
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 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.
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.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
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.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search. Game playing u Multi-agent competitive environment u The most common games are deterministic, turn- taking, two-player, zero-sum game.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
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. Regular Tic Tac Toe Play a few games. –What is the expected outcome –What kinds of moves “guarantee” that?
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
February 25, 2016Introduction to Artificial Intelligence Lecture 10: Two-Player Games II 1 The Alpha-Beta Procedure Can we estimate the efficiency benefit.
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.
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
1 Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game.
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Adversarial Search.
Game Playing.
Alpha-Beta Search.
Alpha-Beta Search.
Search and Game Playing
Alpha-Beta Search.
Alpha-Beta Search.
Mini-Max search Alpha-Beta pruning General concerns on games
Alpha-Beta Search.
Unit II Game Playing.
Presentation transcript:

Minimax

Two Player Game Playing Use backtracking to implement computer version of 2-player games: tic-tac-toe, chess, checkers, connect four Minimax algorithm: Backtracking algorithm for choosing next move in an 2-player game Value associated with each position of the game The player wants to make the move that maximizes the minimum value of the position resulting from the opponent’s following move

Game Tree X X X X X X X X X

Game Tree X moves O moves X moves O moves X O X O X O X O X O X O X O

Game Tree 1 -1 1 1 -1 1 X moves O moves X moves O moves X O X O X O X 1 X O X O X O X O X moves 1 -1 X O X O X O O moves 1

Minimax Algorithm - Strategies Winning Strategy If the root has value 1, then player 1 has a winning strategy Termination guarantee implies an eventual win for player 1 If the root has value -1, then player 2 has a winning strategy If the root has value 0, then the best a player can do is guarantee himself a draw Does tic-tac-toe have a winning strategy?

Payoff Functions The game tree can be generalize to trees with payoff values Same minimax rules apply Chess Use payoff to estimate probability of a win

Minimax Algorithm Backtracking algorithm on the game tree Tells us the best move (and whether it’s a winning strategy) Start with the board at some current position Explore all possibilities from this position Assign values {-1, 0, 1} after all children have returned

Minimax Algorithm 1 = max(1, -1, 0) -1 = min(0, -1) 0 = min(0, 1) 1 X moves 1 = max(1, -1, 0) X O X O X O O moves -1 = min(0, -1) 0 = min(0, 1) 1 X O X O X O X O X moves 0 = max(0) 0 = max(0) 1 = max(1) -1 X O X O X O O moves 1

Minimax Pseudocode int Minimax(state, level) { if(state is a solution) //base case return state’s value if(level is a max) { while(state has more children) Minimax(child, level+1) if value returned is > best so far, store it } return maximum returned value } else { //level is a min level if value returned is < best so far, store it return minimum returned value

Alpha-Beta Pruning A B I P C F J M Q T D E G H K L N O R S U V 5 2 5 4 max A 5 min B I P 2 5 4 max C F J M Q T 2 6 8 5 4 6 D E G H K L N O R S U V 2 1 6 1 8 3 5 2 3 4 2 6

Alpha-Beta Pruning Rules for pruning: At a max node q: If p is a min node with parent q and p & q have “tentative” values v1 and v2 such that v1  v2, then you can prune all the unconsidered children of p. At a min node q: If p is a max node with parent q and p & q have “tentative” values v1 and v2 such that v1  v2, then you can prune all the unconsidered children of p.

Minimax Algorithm Pruned Pruned = -  =  = 1  =  = 1  =  X moves = -  =  = 1  =  X O X O X O O moves = 1  =  = 1  = 0 1 = 1  = 0 = 1  =  X O X O X O X O X moves Pruned Pruned = 1  =  -1 = 1  =  X O X O X O O moves 1

Alpha-Beta Pseudocode int Minimax(state, level, alpha, beta) { if(state is a solution) //base case return state’s value if(level is a max) { while(state has more children and alpha < beta) Minimax(child, level+1, alpha, beta) if value returned is > alpha, store it } return alpha } else { //level is a min level if value returned is < beta, store it return beta