Game playing.

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.
Artificial Intelligence 1: game playing Lecturer: Tom Lenaerts SWITCH, Vlaams Interuniversitair Instituut voor Biotechnologie.
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.
Game playing. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
February 7, 2006AI: Chapter 6: Adversarial Search1 Artificial Intelligence Chapter 6: Adversarial Search Michael Scherger Department of Computer Science.
Games & Adversarial Search
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.
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.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Game Tree Search based on Russ Greiner and Jean-Claude Latombe’s notes.
double AlphaBeta(state, depth, alpha, beta) begin if depth
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.
Adversarial Search Chapter 5 Adapted from Tom Lenaerts’ lecture notes.
Game Playing: Adversarial Search Dr. Yousef Al-Ohali Computer Science Depart. CCIS – King Saud University Saudi Arabia
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.
Adversarial Search; Heuristics in Games Foundations of Artificial Intelligence.
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 Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
Adversarial Search Adversarial Search (game playing search) We have experience in search where we assume that we are the only intelligent being and we.
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
Adversarial Search and Game Playing Russell and Norvig: Chapter 5 Russell and Norvig: Chapter 6 CS121 – Winter 2003.
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?
EA C461 – Artificial Intelligence Adversarial Search
4. Games and adversarial search
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
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.
Game playing.
Games & Adversarial Search
Games & Adversarial Search
Game Playing: Adversarial Search
Adversarial Search and Game Playing
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:

Game playing

Outline Optimal decisions α-β pruning Imperfect, real-time decisions

Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent repl Time limits  unlikely to find goal, must approximate

Game tree (2-player, deterministic, turns)

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

Minimax algorithm

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

α-β pruning example

α-β pruning example

α-β pruning example

α-β pruning example

α-β pruning example

Properties of α-β Pruning does not affect final result Good move ordering improves effectiveness of pruning With "perfect ordering," time complexity = O(bm/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

The α-β algorithm

How much do we gain? Assume a game tree of uniform branching factor b Minimax examines O(bh) nodes, so does alpha-beta in the worst-case The gain for alpha-beta is maximum when: The MIN children of a MAX node are ordered in decreasing backed up values The MAX children of a MIN node are ordered in increasing backed up values Then alpha-beta examines O(bh/2) nodes [Knuth and Moore, 1975] But this requires an oracle (if we knew how to order nodes perfectly, we would not need to search the game tree) If nodes are ordered at random, then the average number of nodes examined by alpha-beta is ~O(b3h/4)

Heuristic Ordering of Nodes Order the nodes below the root according to the values backed-up at the previous iteration Order MAX (resp. MIN) nodes in decreasing (increasing) values of the evaluation function computed at these nodes

Games of imperfect information Minimax and alpha-beta pruning require too much leaf-node evaluations. May be impractical within a reasonable amount of time. SHANNON (1950): Cut off search earlier (replace TERMINAL-TEST by CUTOFF-TEST) Apply heuristic evaluation function EVAL (replacing utility function of alpha-beta)

Cutting off search Change: if TERMINAL-TEST(state) then return UTILITY(state) into if CUTOFF-TEST(state,depth) then return EVAL(state) Introduces a fixed-depth limit depth Is selected so that the amount of time will not exceed what the rules of the game allow. When cuttoff occurs, the evaluation is performed.

Heuristic EVAL Idea: produce an estimate of the expected utility of the game from a given position. Performance depends on quality of EVAL. Requirements: EVAL should order terminal-nodes in the same way as UTILITY. Computation may not take too long. For non-terminal states the EVAL should be strongly correlated with the actual chance of winning. Only useful for quiescent (no wild swings in value in near future) states

Heuristic EVAL example Eval(s) = w1 f1(s) + w2 f2(s) + … + wnfn(s)

Heuristic EVAL example Addition assumes independence Eval(s) = w1 f1(s) + w2 f2(s) + … + wnfn(s)

Heuristic difficulties Heuristic counts pieces won

Horizon effect Fixed depth search thinks it can avoid the queening move

Games that include chance Possible moves (5-10,5-11), (5-11,19-24),(5-10,10-16) and (5-11,11-16)

Games that include chance chance nodes Possible moves (5-10,5-11), (5-11,19-24),(5-10,10-16) and (5-11,11-16) [1,1], [6,6] chance 1/36, all other chance 1/18

Games that include chance [1,1], [6,6] chance 1/36, all other chance 1/18 Can not calculate definite minimax value, only expected value

Expected minimax value EXPECTED-MINIMAX-VALUE(n)= UTILITY(n) if n is a terminal maxs  successors(n) MINIMAX-VALUE(s) if n is a max node mins  successors(n) MINIMAX-VALUE(s) if n is a max node s  successors(n) P(s) . EXPECTEDMINIMAX(s) if n is a chance node These equations can be backed-up recursively all the way to the root of the game tree.

Position evaluation with chance nodes Left, A1 wins Right A2 wins Outcome of evaluation function may not change when values are scaled differently. Behavior is preserved only by a positive linear transformation of EVAL. פונקציות הערכה למשחקים עם מזל מתנהגות שונה מאשר אלה של שחמט למשל – שבהן רק הסדר קובע. כאן הסקלה יכולה להכריע.

State-of-the-Art

Checkers: Tinsley vs. Chinook Name: Marion Tinsley Profession: Teach mathematics Hobby: Checkers Record: Over 42 years loses only 3 games of checkers World champion for over 40 years Mr. Tinsley suffered his 4th and 5th losses against Chinook

Chinook First computer to become official world champion of Checkers! Has all endgame table for 10 pieces or less: over 39 trillion entries.

Chess: Kasparov vs. Deep Blue 5’10” 176 lbs 34 years 50 billion neurons 2 pos/sec Extensive Electrical/chemical Enormous Height Weight Age Computers Speed Knowledge Power Source Ego Deep Blue 6’ 5” 2,400 lbs 4 years 32 RISC processors + 256 VLSI chess engines 200,000,000 pos/sec Primitive Electrical None 1997: Deep Blue wins by 3 wins, 1 loss, and 2 draws

Chess: Kasparov vs. Deep Junior 8 CPU, 8 GB RAM, Win 2000 2,000,000 pos/sec Available at $100 August 2, 2003: Match ends in a 3/3 tie!

Othello: Murakami vs. Logistello Takeshi Murakami World Othello Champion 1997: The Logistello software crushed Murakami by 6 games to 0

Go: Goemate vs. ?? Name: Chen Zhixing Profession: Retired Computer skills: self-taught programmer Author of Goemate (arguably the best Go program available today) Gave Goemate a 9 stone handicap and still easily beat the program, thereby winning $15,000

Go: Goemate vs. ?? Name: Chen Zhixing Profession: Retired Computer skills: self-taught programmer Author of Goemate (arguably the strongest Go programs) Go has too high a branching factor for existing search techniques Current and future software must rely on huge databases and pattern-recognition techniques Gave Goemate a 9 stone handicap and still easily beat the program, thereby winning $15,000 Jonathan Schaeffer

Backgammon 1995 TD-Gammon by Gerald Thesauro won world championship on 1995 BGBlitz won 2008 computer backgammon olympiad

Secrets Many game programs are based on alpha-beta + iterative deepening + extended/singular search + transposition tables + huge databases + ... For instance, Chinook searched all checkers configurations with 8 pieces or less and created an endgame database of 444 billion board configurations The methods are general, but their implementation is dramatically improved by many specifically tuned-up enhancements (e.g., the evaluation functions) like an F1 racing car

Perspective on Games: Con and Pro Chess is the Drosophila of artificial intelligence. However, computer chess has developed much as genetics might have if the geneticists had concentrated their efforts starting in 1910 on breeding racing Drosophila. We would have some science, but mainly we would have very fast fruit flies. John McCarthy Saying Deep Blue doesn’t really think about chess is like saying an airplane doesn't really fly because it doesn't flap its wings. Drew McDermott

Other Types of Games Multi-player games, with alliances or not Games with randomness in successor function (e.g., rolling a dice)  Expectminimax algorithm Games with partially observable states (e.g., card games)  Search of belief state spaces See R&N p. 175-180