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.

Slides:



Advertisements
Similar presentations
Chapter 6, Sec Adversarial Search.
Advertisements

Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Game Playing Perfect decisions Heuristically based decisions Pruning search trees Games involving chance.
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4. Warm Up Let’s play some games!
CSC 8520 Spring Paula Matuszek CS 8520: Artificial Intelligence Solving Problems by Searching Paula Matuszek Spring, 2010 Slides based on Hwee Tou.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
1 Game Playing. 2 Outline Perfect Play Resource Limits Alpha-Beta pruning Games of Chance.
Adversarial Search Game Playing Chapter 6. Outline Games Perfect Play –Minimax decisions –α-β pruning Resource Limits and Approximate Evaluation Games.
Adversarial Search CSE 473 University of Washington.
Adversarial Search Chapter 6.
Artificial Intelligence for Games Game playing Patrick Olivier
Adversarial Search 對抗搜尋. Outline  Optimal decisions  α-β pruning  Imperfect, real-time decisions.
An Introduction to Artificial Intelligence Lecture VI: Adversarial Search (Games) Ramin Halavati In which we examine problems.
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
10/19/2004TCSS435A Isabelle Bichindaritz1 Game and Tree Searching.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
EIE426-AICV 1 Game Playing Filename: eie426-game-playing-0809.ppt.
G51IAI Introduction to AI Minmax and Alpha Beta Pruning Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
This time: Outline Game playing The minimax algorithm
Game Playing CSC361 AI CSC361: Game Playing.
Games and adversarial search
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Games & Adversarial Search Chapter 6 Section 1 – 4.
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
1 Game Playing Why do AI researchers study game playing? 1.It’s a good reasoning problem, formal and nontrivial. 2.Direct comparison with humans and other.
Games as Game Theory Systems (Ch. 19). Game Theory It is not a theoretical approach to games Game theory is the mathematical study of decision making.
Adversarial Search Chapter 6 Section 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Introduction to Artificial Intelligence CS 438 Spring 2008 Today –AIMA, Ch. 6 –Adversarial Search Thursday –AIMA, Ch. 6 –More Adversarial Search The “Luke.
1 Adversarial Search CS 171/271 (Chapter 6) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.
CHAPTER 4 PROBABILITY THEORY SEARCH FOR GAMES. Representing Knowledge.
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,
Paula Matuszek, CSC 8520, Fall Based in part on aima.eecs.berkeley.edu/slides-ppt 1 CS 8520: Artificial Intelligence Adversarial Search Paula Matuszek.
Artificial Intelligence
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides)
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Adversarial Search Chapter 5 Sections 1 – 4. AI & Expert Systems© Dr. Khalid Kaabneh, AAU Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
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.
5/4/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 9, 5/4/2005 University of Washington, Department of Electrical Engineering Spring 2005.
Game Playing Why do AI researchers study game playing?
Game Playing Why do AI researchers study game playing?
EA C461 – Artificial Intelligence Adversarial Search
PENGANTAR INTELIJENSIA BUATAN (64A614)
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Adversarial Search Chapter 5.
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
Games & Adversarial Search
Games & Adversarial Search
Game Playing Fifth Lecture 2019/4/11.
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4.
Presentation transcript:

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 (actions or moves) -a terminal test -a utility (payoff) function

1.Multi-agent environment –Multi-player games involve planning and acting in environments populated by other active agents –Agents use sense/plan/act architecture that does not plan too far into the unpredictable future –But with proper information agent can construct plan that consider the effects of the actions of other agents – In AI we will consider the special case of a games, deterministic turn taking two-player zero sum games of perfect-information 2.Zero Sum Games –either one of them wins (and the other loses), or a draw results –+1 win -1 loss 0 draw 3.Agents utility functions make the games adversarial COMP-4640: Intelligent & Interactive Systems Game Playing

Multi-agent environment Robot Soccer COMP-4640: Intelligent & Interactive Systems Game Playing

Game tree (2-player, deterministic, turns)

COMP-4640: Intelligent & Interactive Systems Game Playing The Minimax Algorithm

COMP-4640: Intelligent & Interactive Systems Game Playing The Minimax Algorithm

COMP-4640: Intelligent & Interactive Systems Game Playing The evaluation function: Must have the same terminal states (goal states) as the utility function Must be of reasonable complexity so that it can be computed quickly (this is a trade-off between Accuracy and Time) Should be accurate The performance of the game playing system depends on the accuracy “goodness” of the evaluation function

COMP-4640: Intelligent & Interactive Systems Game Playing One problem with using minimax is that it may not be feasible to search the whole game tree for a minimax decision (move or action) Using depth-limited search may speed thing up the minimax decision process but instead of using the utility function one would need to construct an evaluation fuction. This evaluation function would provide an estimate of the expected utility of a game position

COMP-4640: Intelligent & Interactive Systems Game Playing Properties of minimax Complete? Yes (if tree is finite) Optimal? Yes (against an optimal opponent) Time complexity? O(b m ) Space complexity? O(bm) (depth-first exploration) For chess, b ≈ 35, m ≈100 for "reasonable" games  exact solution completely infeasible

Once we have developed a good evaluation function, we must also consider: The depth-limit The Horizon Problem –Difficult to eliminate –When a program is facing a move by the opponent that causes serious damage and is ultimately unavoidable –Stalling pushes the move over the horizon to a place where it can’t be detected COMP-4640: Intelligent & Interactive Systems Game Playing

Once we have an evaluation function and a depth-limit we can then re-apply minimax search. However, for depth-limited search minimax may still be inefficient. Minimax will expand nodes that need not be searched. By making our search method more efficient, we will be able to search at deeper levels of our game tree. COMP-4640: Intelligent & Interactive Systems Game Playing

COMP-4640: Intelligent & Interactive Systems Game Playing: Alpha-Beta Pruning 1.Search below a MIN node may be alpha-pruned if the beta value is < to the alpha value of some MAX ancestor. 2. Search below a MAX node may be beta-pruned if the alpha value is > to the beta value of some MIN ancestor. 2 7

Alpha-Beta Pruning (αβ prune) Rules of Thumb –α is the highest max found so far –β is the lowest min value found so far –If Min is on top Alpha prune –If Max is on top Beta prune –You will only have alpha prune’s at Min level –You will only have beta prunes at Max level –See detailed algorithm p167

COMP-4640: Intelligent & Interactive Systems Game Playing: Alpha-Beta Pruning 1.Search below a MIN node may be alpha-pruned if the beta value is < to the alpha value of some MAX ancestor. 2. Search below a MAX node may be beta-pruned if the alpha value is > to the beta value of some MIN ancestor. 2 7

COMP-4640: Intelligent & Interactive Systems Game Playing: Alpha-Beta Pruning 1.Search below a MIN node may be alpha-pruned if the beta value is < to the alpha value of some MAX ancestor. 2. Search below a MAX node may be beta-pruned if the alpha value is > to the beta value of some MIN ancestor β 5

COMP-4640: Intelligent & Interactive Systems Game Playing: Alpha-Beta Pruning 1.Search below a MIN node may be alpha-pruned if the beta value is < to the alpha value of some MAX ancestor. 2. Search below a MAX node may be beta-pruned if the alpha value is > to the beta value of some MIN ancestor α β

COMP-4640: Intelligent & Interactive Systems Game Playing: Alpha-Beta Pruning 1.Search below a MIN node may be alpha-pruned if the beta value is < to the alpha value of some MAX ancestor. 2. Search below a MAX node may be beta-pruned if the alpha value is > to the beta value of some MIN ancestor αα β

COMP-4640: Intelligent & Interactive Systems Game Playing

α β

COMP-4640: Intelligent & Interactive Systems Game of Chance: Expecti-minimax Initial value of leaves indicate board state Use percentage chance based upon roll for first calculated value Min eval f(n) selects Max value The second roll uses different assigned percentage chance Max eval f(n) selects Max value

COMP-4640: Intelligent & Interactive Systems Game of Chance: Expecti-minimax (3*1.0) Initial value of leaves indicate board state Use percentage chance based upon roll for first calculated value Min eval f(n) selects Max value The second roll uses different assigned percentage chance Max eval f(n) selects Max value

COMP-4640: Intelligent & Interactive Systems Game of Chance: Expecti-minimax (3*1.0) Initial value of leaves indicate board state Use percentage chance based upon roll for first calculated value Min eval f(n) selects Max value The second roll uses different assigned percentage chance Max eval f(n) selects Max value

COMP-4640: Intelligent & Interactive Systems Game of Chance: Expecti-minimax (0* *0.33) 2 2 (3*1.0) Initial value of leaves indicate board state Use percentage chance based upon roll for first calculated value Min eval f(n) selects Max value The second roll uses different assigned percentage chance Max eval f(n) selects Max value

COMP-4640: Intelligent & Interactive Systems Game of Chance: Expecti-minimax (0* *0.33) 2 2 (3*1.0) Initial value of leaves indicate board state Use percentage chance based upon roll for first calculated value Min eval f(n) selects Max value The second roll uses different assigned percentage chance Max eval f(n) selects Max value

COMP-4640: Intelligent & Interactive Systems Game of Chance: Expecti-minimax (0* *0.33) (3*1.0) Initial value of leaves indicate board state Use percentage chance based upon roll for first calculated value Min eval f(n) selects Max value The second roll uses different assigned percentage chance Max eval f(n) selects Max value

Cutting off search MinimaxCutoff is identical to MinimaxValue except 1.Terminal? is replaced by Cutoff? 2.Utility is replaced by Eval Does it work in practice? b m = 10 6, b=35  m=4 4-ply lookahead is a hopeless chess player! –4-ply ≈ human novice –8-ply ≈ typical PC, human master –12-ply ≈ Deep Blue, Kasparov

COMP-4640: Deterministic games in practice Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in Used a precomputed endgame database defining perfect play for all positions involving 8 or fewer pieces on the board, a total of 444 billion positions. Chess: Deep Blue defeated human world champion Garry Kasparov in a six-game match in Deep Blue searches 200 million positions per second, uses very sophisticated evaluation, and undisclosed methods for extending some lines of search up to 40 ply.Deep Blue Othello: human champions refuse to compete against computers, who are too good.Othello Go: human champions refuse to compete against computers, who are too bad. In go, b > 300, so most programs use pattern knowledge bases to suggest plausible moves.Go