Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides)

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.
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.
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.
1 Game Playing. 2 Outline Perfect Play Resource Limits Alpha-Beta pruning Games of Chance.
Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides)
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.
Hoe schaakt een computer? Arnold Meijster. Why study games? Fun Historically major subject in AI Interesting subject of study because they are hard Games.
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.
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.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
How computers play games with you CS161, Spring ‘03 Nathan Sturtevant.
Game Tree Search based on Russ Greiner and Jean-Claude Latombe’s notes.
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.
Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides)
CSC 412: AI 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.
Computing & Information Sciences Kansas State University Wednesday, 13 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 9 of 42 Wednesday, 13 September.
Projects Analyze Existing Game project –Due next class. Re-check the guidelines on course’s website! Create your Own Project –Due: Final game due Tuesday.
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.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.
Computing & Information Sciences Kansas State University Wednesday, 12 Sep 2007CIS 530 / 730: Artificial Intelligence Lecture 9 of 42 Wednesday, 12 September.
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
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.
Artificial Intelligence AIMA §5: Adversarial Search
Game Playing Why do AI researchers study game playing?
Game Playing Why do AI researchers study game playing?
EA C461 – Artificial Intelligence Adversarial Search
CS 460 Spring 2011 Lecture 4.
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:

Turn-Based Games Héctor Muñoz-Avila sources: Wikipedia.org Russell & Norvig AI Book; Chapter 5 (and slides) My own

Turn-Based Strategy Games Early strategy games was dominated by turn- based games Derivate from board games Chess The Battle for Normandy (1982) Nato Division Commanders (1985) Turn-based strategy: game flow is partitioned in turns or rounds. Turns separate analysis by the player from actions “harvest, build, destroy” in turns Two classes: Simultaneous Mini-turns

Turn-Based Games Continues to be A Popular Game Genre At least 3 sub-styles are very popular: –“Civilization”-style games Civilization IV came out last week –Fantasy-style (RPG) Heroes of Might and Magic series –Poker games Poker Academy

Some Historical Highlights 1952 Turing design a chess algorithm. Around the same time Claude Shannon also develop a chess program 1956 Maniac versus Human 1970 Hamurabi. A game about building an economy for a kingdom The Battle for Normandy (1982) 1987 Pirates! 1990 Civilization 1995 HoMM 1996 Civilization II The best game ever? … 2005 Civilization IV 2006 HoMM V

Side-tracking: Game Design: Contradicting Principles Principle: All actions can be done from a single screen. Classical example: Civ IVCiv IV But: HoMM uses two interfaces: HoMM IVHoMM IV

Coming back: How to Construct Good AI? Idea: Lets just use A* and define a good heuristic for the game  Search space: a bipartite tree  After all didn’t we use it with the 9-puzzle game? Problems with this idea:  Adversarial: we need to consider possible moves of our opponent (s)  Time limit: (think Chess)

Types of Adversarial TBGs (from AI perspective) Perfect information Imperfect information Deterministic Chance Chess, Go, rock- paper-scissors Battleships, Stratego Backgammon, monopoly Civilization, HoMM Bridge, Poker

Game tree (2-player, deterministic, turns) Concepts: State: node in search space Operator: valid move Terminal test: game over Utility function: value for outcome of the game MAX: 1 st player, maximizing its own utility MIN: 2 nd player, minimizing Max’s utility

Minimax Finding perfect play for deterministic games Idea: choose move to position with highest minimax value = best achievable payoff against best play E.g., 2-play game:

Minimax algorithm

Properties of minimax Complete? Optimal? Time complexity? –b: branching factor –m: # moves in a game Yes (if tree is finite) Yes (against an optimal opponent) O(b m ) For chess, b ≈ 35, m ≈100 for "reasonable" games Therefore, exact solution is infeasible

Minimax algorithm with Imperfect Decisions evaluationFunction(state) Cutoff-test(state)

Evaluation Function –Is an estimate of the actual utility –Typically represented as a linear function: EF(state) = w 1 f 1 (state) + w 2 f 2 (state) + … + w n f n (state) –Example: Chess weight: Piece  Number  (w 1 ) Pawn  1  (w 2 ) Knight  3  (w 3 ) Bishop  3  (w 4 ) Rook  5  (w 5 ) Queen  9 Function; state  Number  f 1 = #(pawns,b)  #(pawns,w)  f 2 = #(knight,b)  #(knight,w)  f 3 = #(bishop,b)  #(bishop,w)  f 4 = #(rook,b)  #(rook,w)  f 5 = #(knight,b)  #(knight,w)

Evaluation Function (2) Obviously, the quality of the AI player depends on the evaluation function Conditions for evaluation functions:  If n is a terminal node,  Computing EF should not take long  EF should reflect chances of winning EF(n) = Utility(n) If EF(state) > 3 then is almost-certain that blacks win

Cutting Off Search

α-β pruning example

Properties of α-β Pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(b m/2 )  doubles depth of search A simple example of the value of reasoning about which computations are relevant (a form of metareasoning)

Why is it called α-β? α is the value of the best (i.e., highest-value) choice found so far at any choice point along the path for max If v is worse than α, max will avoid it  prune that branch Define β similarly for min

The α-β algorithm

Resource limits Suppose we have 100 secs, explore 10 4 nodes/sec  10 6 nodes per move Standard approach: cutoff test: e.g., depth limit (perhaps add quiescence search) evaluation function = estimated desirability of position

Evaluation functions For chess, typically linear weighted sum of features Eval(s) = w 1 f 1 (s) + w 2 f 2 (s) + … + w n f n (s) e.g., w 1 = 9 with f 1 (s) = (number of white queens) – (number of black queens), etc.

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

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. Othello: human champions refuse to compete against computers, who are too good. 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.

Summary Games are fun to work on! They illustrate several important points about AI perfection is unattainable  must approximate good idea to think about what to think about