Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Game Playing Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy.

Slides:



Advertisements
Similar presentations
Adversarial Search Chapter 6 Sections 1 – 4. Outline Optimal decisions α-β pruning Imperfect, real-time decisions.
Advertisements

Game Playing CS 63 Chapter 6
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.
Games & Adversarial Search
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
1 CSC 550: Introduction to Artificial Intelligence Fall 2008 search in game playing  zero-sum games  game trees, minimax principle  alpha-beta pruning.
CS 484 – Artificial Intelligence
Adversarial Search Chapter 6 Section 1 – 4.
Adversarial Search Chapter 5.
Adversarial Search: Game Playing Reading: Chapter next time.
Adversarial Search CSE 473 University of Washington.
G5AIAI Introduction to AI Graham Kendall Game Playing Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Artificial Intelligence for Games Game playing Patrick Olivier
1 Adversarial Search Chapter 6 Section 1 – 4 The Master vs Machine: A Video.
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.
Lecture 13 Last time: Games, minimax, alpha-beta Today: Finish off games, summary.
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
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
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)
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Adversarial Search: Game Playing Reading: Chess paper.
double AlphaBeta(state, depth, alpha, beta) begin if depth
Games & Adversarial Search Chapter 6 Section 1 – 4.
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.
CSC 412: AI Adversarial Search
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Game Playing.
MIU Mini-Max Graham Kendall Game Playing Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.
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.
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.
Games 1 Alpha-Beta Example [-∞, +∞] Range of possible values Do DF-search until first leaf.
GAME PLAYING 1. There were two reasons that games appeared to be a good domain in which to explore machine intelligence: 1.They provide a structured task.
Game Playing Revision Mini-Max search Alpha-Beta pruning General concerns on games.
Artificial Intelligence
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!)
G51IAI Introduction to AI Andrew Parkes Game Playing 2: Alpha-Beta Search and General Issues.
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.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
1 Chapter 6 Game Playing. 2 Chapter 6 Contents l Game Trees l Assumptions l Static evaluation functions l Searching game trees l Minimax l Bounded lookahead.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
PENGANTAR INTELIJENSIA BUATAN (64A614)
Games and adversarial search (Chapter 5)
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
Mini-Max search Alpha-Beta pruning General concerns on games
Artificial Intelligence
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Games & Adversarial Search
Presentation transcript:

Introduction to Artificial Intelligence (G51IAI) Dr Rong Qu Game Playing Garry Kasparov and Deep Blue. © 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.

G51IAI - Game Playing Game Playing Up till now we have assumed the situation is not going to change whilst we search Shortest route between two towns The same goal board of 8-puzzle, n-Queen Game playing is not like this Not sure of the state after your opponent move Goals of your opponent is to prevent your goal, and vice versa

G51IAI - Game Playing Game Playing In these two hours Brief history of game playing in AI Important techniques in AI game playing Minimax Alpha beta pruning

G51IAI - Game Playing Game Playing Game Playing has been studied for a long time Babbage ( ) Analytical machine tic-tac-toe Turing ( ) Chess playing program Within 10 years a computer will be a chess champion Herbert Simon, 1957

G51IAI - Game Playing Game Playing Why study game playing in AI Games are intelligent activities It is very easy to measure success or failure Do not require large amounts of knowledge They were thought to be solvable by straightforward search from the starting state to a winning position

G51IAI - Game Playing Game Playing - Checkers Arthur Samuel 1952 – first checker program, written for an IBM Re-wrote for an IBM ,000 words of main memory

G51IAI - Game Playing Game Playing - Checkers Arthur Samuel Added a learning mechanism that learnt its own evaluation function by playing against itself After a few days it could beat its creator And compete on equal terms with strong human players

G51IAI - Game Playing Game Playing - Checkers Jonathon Schaeffer – Chinook, 1996 In 1992 Chinook won the US Open Plays a perfect end game by means of a database And challenged for the world championship

G51IAI - Game Playing Game Playing - Checkers Jonathon Schaeffer – Chinook, 1996 Dr Marion Tinsley World championship for over 40 years, only losing three games in all that time Against Chinook he suffered his fourth and fifth defeat But ultimately won 21.5 to 18.5

G51IAI - Game Playing Game Playing - Checkers Jonathon Schaeffer – Chinook, 1996 Dr Marion Tinsley In August 1994 there was a re-match but Marion Tinsley withdrew for health reasons Chinook became the official world champion

G51IAI - Game Playing Game Playing - Checkers Jonathon Schaeffer – Chinook, 1996 Uses Alpha-Beta search Did not include any learning mechanism Schaeffer claimed Chinook was rated at 2814 The best human players are rated at 2632 and 2625

G51IAI - Game Playing Game Playing - Checkers Chellapilla and Fogel – 2000 “Learnt” how to play a good game of checkers The program used a population of games with the best competing for survival Learning was done using a neural network with the synapses being changed by an evolutionary strategy Input: current board position Output: a value used in minimax search

G51IAI - Game Playing Game Playing - Checkers Chellapilla and Fogel – 2000 During the training period the program is given no information other than whether it won or lost (it is not even told by how much) No strategy and no database of opening and ending positions The best program beats a commercial application 6-0 The program was presented at CEC 2000 (San Diego) and prize remain unclaimed

G51IAI - Game Playing Game Playing - Chess No computer can play even an amateur-level game of chess Hubert Dreyfus, 1960’s

G51IAI - Game Playing Game Playing - Chess Shannon - March 9 th New York Size of search space ( average of 40 moves) > number of atoms in the universe 200 million positions/second = years to evaluate all possible games Age of universe = Searching to depth = 40, at one state per microsecond, it would take years to make its first move

G51IAI - Game Playing Game Playing - Chess 1957 – AI pioneers Newell and Simon predicted that a computer would be chess champion within ten years Simon: “I was a little far-sighted with chess, but there was no way to do it with machines that were as slow as the ones way back then” First computer to play chess was an IBM 704 about one millionth capacity of deep blue

G51IAI - Game Playing Game Playing - Chess 1967 : Mac Hack competed successfully in human tournaments 1983 : “Belle” attained expert status from the United States Chess Federation Mid 80’s : Scientists at Carnegie Mellon University started work on what was to become Deep Blue Sun workstation, 50K positions per second Project moved to IBM in 1989

G51IAI - Game Playing Game Playing - Chess May 11th 1997, Gary Kasparov lost a six match game to deep blue, IBM Research 3.5 to 2.5 Two wins for deep blue, one win for Kasparov and three draws (

G51IAI - Game Playing Game Playing - Chess Still receives a lot of research interests Computer program to “learn” how to play chess, rather than being “told” how it should play Research on game playing at School of CS, Nottingham

G51IAI - Game Playing Game Playing – Go* A significant challenge to computer programmers, not yet much helped by fast computation Search methods successful for chess and checkers do not work for Go, due to many qualities of the game Larger area of the board (five times the chess board) New piece appears every move - progressively more complex *wikipedia:

G51IAI - Game Playing Game Playing – Go* A significant challenge to computer programmers, not yet much helped by fast computation Search methods successful for chess and checkers do not work for Go, due to many qualities of the game A material advantage in Go may just mean that short-term gain has been given priority Very high degree of pattern recognition involved in human capacity to play well … *wikipedia:

G51IAI - Game Playing Game Playing Other games in research Poker Othello … Previous third year projects Chess Poker Blackjack …

G51IAI - Game Playing Game Playing - Minimax Game Playing An opponent tries to thwart your every move John von Neumann outlined a search method (Minimax) maximise your position whilst minimising your opponent’s

G51IAI - Game Playing Game Playing - Minimax In order to implement we need a method of measuring how good a position is Often called a utility function Initially this will be a value that describes our position exactly

DEFG = terminal position= agent = opponent MAX MIN MAX 1-3 B C A Assume we can generate the full search tree Of course for larger problem it’s not possible to draw the entire tree Game starts with computer making the first move Then the opponent makes the next move Now we can decide who win the game Assume positive: computer wins We know absolutely who will win following a branch The idea is computer wants to force the opponent to lose, and maximise its own chance of winning Values are propagated back up through the tree based on whose turn it is and whether they are trying to maximise or minimise at the point

DEFG = terminal position= agent = opponent MAX MIN MAX 1-3 B C A Now the computer is able to play a perfect game. At each move it’ll move to a state of the highest value. Question: who will win this game, if both players play a perfect game?

G51IAI - Game Playing Game Playing - Minimax Nim Start with a pile of tokens At each move the player must divide the tokens into two non-empty, non-equal piles + + +

G51IAI - Game Playing Game Playing - Minimax Nim Starting with 7 tokens, draw the complete search tree At each move the player must divide the tokens into two non-empty, non-equal piles

G51IAI - Game Playing Game Playing - Minimax Conventionally, in discussion of minimax, have two players “MAX” and “MIN” The utility function is taken to be the utility for MAX Larger values are better for “MAX”

G51IAI - Game Playing Game Playing - Minimax Assuming MIN plays first, complete the MIN/MAX tree Assume that a utility function of 0 = a win for MIN 1 = a win for MAX

G51IAI - Game Playing Game Playing - Minimax Player MAX is going to take the best move available Will select the next state to be the one with the highest utility Hence, value of a MAX node is the MAXIMUM of the values of the next possible states i.e. the maximum of its children in the search tree

G51IAI - Game Playing Game Playing - Minimax Player MIN is going to take the best move available for MIN i.e. the worst available for MAX Will select the next state to be the one with the lowest utility higher utility values are better for MAX and so worse for MIN Hence, value of a MIN node is the MINIMUM of the values of the next possible states i.e. the minimum of its children in the search tree

G51IAI - Game Playing Game Playing - Minimax A “MAX” move takes the best move for MAX so takes the MAX utility of the children A “MIN” move takes the best for min hence the worst for MAX so takes the MIN utility of the children Games alternate in play between MIN and MAX

MIN MAX

G51IAI - Game Playing Game Playing - Minimax Efficiency of the search Game trees are very big Evaluation of positions is time-consuming How can we reduce the number of nodes to be evaluated? “alpha-beta search”

G51IAI - Game Playing Game Playing - Minimax At each node Decide a value which reflects our position of winning from the point Heuristic function Possibility of winning Different from that in A* for search problem, which estimate how close we are to the goal

A BC DE 658 MAX MIN 6>=8 MAX <=6 HIJK = agent= opponent On discovering util( D ) = 6 we know that util( B ) <= 6 On discovering util( J ) = 8 we know that util( E ) >= 8 STOP! What else can you deduce now!? STOP! What else can you deduce now!? Can stop expansion of E as best play will not go via E Value of K is irrelevant – prune it! STOP! What else can you deduce now!?

A BC DEFG 658 MAX MIN 6>=8 MAX 6 HIJKLM = agent= opponent 21 2 <=2 >=6

A BC DEFG 658 MAX MIN 6>=8 MAX 6 HIJKLM = agent= opponent >=6

A BC DEFG 658 MAX MIN 6>=8 MAX 6 HIJKLM = agent= opponent alpha cutoff beta cutoff Alpha-beta Pruning

G51IAI - Game Playing Game Playing - Alpha-beta Pruning If we were doing Breadth-First Search, would you still be able to prune nodes in this fashion? NO! Because the pruning on node D is made by evaluating the tree underneath D This form of pruning relies on doing a Depth- First search

G51IAI - Game Playing Game Playing - Alpha-beta Pruning To maximise pruning we want to first expand those children that are best for the parent cannot know which ones are really best use heuristics for the “best-first” ordering If this is done well then alpha-beta search can effectively double the depth of search tree that is searchable in a given time Effectively reduces the branching factor in chess from about 30 to about 8 This is an enormous improvement!

G51IAI - Game Playing Game Playing - Alpha-beta Pruning The pruning was based on using the results of the “DFS so far” to deduce upper and lower bounds on the values of nodes Conventionally these bounds are stored in terms of two parameters alpha α beta β

G51IAI - Game Playing Game Playing - Alpha-beta Pruning α values are stored with each MAX node each MAX node is given a value of alpha that is the current best lower-bound on its final value initially is - ∞ to represent that nothing is known as we do the search then α at a node can increase, but it can never decrease – it always gets better for MAX

G51IAI - Game Playing Game Playing - Alpha-beta Pruning β values are stored with each MIN node each MIN node is given a value of beta that is the current best upper-bound on its final value initially is + ∞ to represent that nothing is known as we do the search then β at a node can decrease, but it can never increase – it always gets better for MIN

A BC DEFG 658 MAX MIN 6 α = 8 MAX β = 6 HIJKLM = agent= opponent alpha pruning as α(E) > β(B) beta pruning as β(C) < α(A) Alpha-beta Pruning

G51IAI - Game Playing Game Playing - classification So far have only considered games such as chess, checkers, and nim These games are: 1. Fully observable Both players have full and perfect information about the current state of the game 2. Deterministic There is no element of chance The outcome of making a sequence of moves is entirely determined by the sequence itself

G51IAI - Game Playing Game Playing - classification Fully vs. Partially Observable Some games are only partially observable Players do not have access to the full “state of the game” e.g. card games – you typically cannot see all of your opponents cards

G51IAI - Game Playing Game Playing - classification Deterministic vs. Stochastic In many games there is some element of chance E.g. Backgammon – throw dice in order to move You are expected to be aware of these simple classifications

G51IAI - Game Playing Summary – game playing History Checkers Chess Go Techniques Minimax Alpha-beta pruning Game classifications