Games CPS 170 Ron Parr. Why Study Games? Many human activities can be modeled as games –Negotiations –Bidding –TCP/IP –Military confrontations –Pursuit/Evasion.

Slides:



Advertisements
Similar presentations
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Advertisements

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
Adversarial Search Chapter 6 Section 1 – 4. Warm Up Let’s play some games!
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
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
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.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Adversarial Search CSE 473 University of Washington.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Artificial Intelligence for Games Game playing Patrick Olivier
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.
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
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)
How computers play games with you CS161, Spring ‘03 Nathan Sturtevant.
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.
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 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.
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.
For Friday Finish reading chapter 7 Homework: –Chapter 6, exercises 1 (all) and 3 (a-c only)
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.
Quiz 4 : Minimax Minimax is a paranoid algorithm. True
For Friday Finish chapter 6 Program 1, Milestone 1 due.
Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
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.
CMSC 421: Intro to Artificial Intelligence October 6, 2003 Lecture 7: Games Professor: Bonnie J. Dorr TA: Nate Waisbrot.
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
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.
Chapter 5 Adversarial Search. 5.1 Games Why Study Game Playing? Games allow us to experiment with easier versions of real-world situations Hostile agents.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Announcements Homework 1 Full assignment posted..
Adversarial Search Chapter 5.
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Presentation transcript:

Games CPS 170 Ron Parr

Why Study Games? Many human activities can be modeled as games –Negotiations –Bidding –TCP/IP –Military confrontations –Pursuit/Evasion Games are used to train the mind –Human game-playing, animal play-fighting

Why Are Games Good for AI? Games typically have concise rules Well-defined starting and end points Sensing and effecting are simplified –Not true for sports games –See robocup Games are fun! Downside: Getting taken seriously (not) –See robo search and rescue

History of Games in AI Computer games have been around almost as long as computers (perhaps longer) –Chess: Turing (and others) in the 1950s –Checkers: Samuel, 1950s learning program Usually start with naïve optimism Follow with naïve pessimism Simon: Computer chess champ by 1967 Many, e.g., Kasparov, predicted that a computer would never be champion

Games Today Computers perform at champion level –Backgammon, Checkers, Chess, Othello Computers perform well –Bridge Computers still do badly –Go, Hex

Game Setup Most commonly, we study games that are: –2 player –Alternating –Zero-sum –Perfect information Examples: Checkers, chess, backgammon Assumptions can be relaxed at some expense Economics studies case where number of agents is very large –Individual actions don’t change the dynamics

Zero Sum Games Assign values to different outcomes Win = 1, Loss = -1 With zero sum games every gain comes at the other player’s expense Sum of both player’s scores must be 0 Are any games truly zero sum?

Characterizing Games Two-player games are very much like search –Initial state –Successor function –Terminal test –Objective function (heuristic function) Unlike search –Terminal states are often a large set –Full search to terminal states usually impossible

Game Trees x o x o x o x o x o x o x o x o x o x o x o x o x xx x o x o x o x x o x o x o x x o x o x o x x o x o x o x x o x o x o x x o x o x o x oo o o o o Player 1 Player 2 Player 1

Game Trees Max nodes Min nodes Terminal Nodes A1 A2 A3 A11 A12 A21 A22 A31A32

Minimax Max player tries to maximize his return Min player tries to minimize his return This is optimal for both (zero sum)

Minimax Values Max nodes Min nodes

Minimax Properties Minimax can be run depth first –Time O(b m ) –Space O(bm) Assumes that opponent plays optimally Based on a worst-case analysis What if this is incorrect?

Minimax in the Real World Search trees are too big Alternating turns double depth of the search –2 ply = 1 full turn Branching factors are too high –Chess: 35 –Go: 361 Search from start never terminates in non- trivial games

Evaluation Functions Like heuristic functions Try to estimate value of a node without expanding all the way to termination Using evaluation functions –Do a depth-limited search –Treat evaluation function as if it were terminal What’s wrong with this? How do you pick the depth? How do you manage your time? Iterative deepening, quiescence

Desiderata for Evaluation Functions Would like to put the same ordering on nodes (even if values aren’t totally right) Is this a reasonable thing to ask for? What if you have a perfect evaluation function? How are evaluation functions made in practice? –Buckets –Linear combinations Chess pieces (material) Board control (positional, strategic)

Search Control Issues Horizon effects –Sometimes something interesting is just beyond the horizon –How do you know? When to generate more nodes? If you selectively extend your frontier, how do you decide where? If you have a fixed amount of total game time, how do you allocate this?

Pruning The most important search control method is figuring out which nodes you don’t need to expand Use the fact that we are doing a worst-case analysis to our advantage –Max player cuts off search when he knows min player can force a provably bad outcome –Min player cuts of search when he knows max can force a provably good (for max) outcome

Alpha-beta pruning Max nodes Min nodes

How to prune We still do (bounded) DFS Expand at least one path to the “bottom” If current node is max node, and min can force a lower value, then prune siblings If curent node is min node, and max can force a higher value, then prune siblings

Max node pruning Max nodes

Implementing alpha-beta max_value(state, alpha, beta) if cutoff(state) then return eval(state) for each s in successors(state) do alpha = max(alpha, min_value(s, alpha, beta)) if alpha >= beta the return beta end return alpha min_value(state, alpha, beta) if cutoff(state) then return eval(state) for each s in successors(state) do beta = min(alpha, max_value(s, alpha, beta)) if beta <= alpha the return alpha end return beta

Amazing facts about alpha-beta Empirically, alpha-beta has the effect of reducing the branching factor by half for many problems This effectively doubles the horizon that can be searched Alpha-beta makes the difference between novice and expert computer players

What About Probabilities? Max nodes Min nodes Chance nodes P=0.5 P=0.6 P=0.4 P=0.9 P=0.1

Expectiminimax n random outcomes per chance node O(b m n m ) time

Expectiminimax is nasty High branching factor Randomness makes evaluation fns difficult –Hard to predict many steps into future –Values tend to smear together –Preserving order is not sufficient Pruning is problematic –Need to prune based upon bound on an expectation –Need a priori bounds on the evaluation function

Multiplayer Games Things sort-of generalize We can maintain a vector of possible values for each player at each node Assume that each player acts greedily What’s wrong with this?

Conclusions Game tree search is a special kind of search Rely heavily on heuristic evaluation functions Alpha-beta is a big win Most successful players use alpha-beta Final thought: Tradeoff between search effort and evaluation function effort When is it better to invest in your evaluation function?