Games 1 Alpha-Beta Example [-∞, +∞] Range of possible values Do DF-search until first leaf.

Slides:



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

Artificial Intelligence 5. Game Playing
Adversarial Search Chapter 6 Section 1 – 4. Types of Games.
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Games & Adversarial Search
For Monday Read chapter 7, sections 1-4 Homework: –Chapter 4, exercise 1 –Chapter 5, exercise 9.
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: Game Playing Reading: Chapter next time.
Adversarial Search CSE 473 University of Washington.
Adversarial Search Chapter 6.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Artificial Intelligence for Games Game playing Patrick Olivier
Artificial Intelligence in Game Design Heuristics and Other Ideas in Board Games.
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.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Game Playing 최호연 이춘우. Overview Intro: Games as search problems Perfect decisions in 2-person games Imperfect decisions Alpha-beta pruning.
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.
Artificial Intelligence in Game Design
This time: Outline Game playing The minimax algorithm
P. Dunne Adapted from slides created by © Franz Kurfess Games 1 Single-Person Game  conventional search problem  identify a sequence of moves.
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.
Adversarial Search: Game Playing Reading: Chess paper.
double AlphaBeta(state, depth, alpha, beta) begin if depth
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.
CSC 412: AI Adversarial Search
CHAPTER 6 : ADVERSARIAL SEARCH
PSU CS 370 – Introduction to Artificial Intelligence Game MinMax Alpha-Beta.
Lecture 6: Game Playing Heshaam Faili University of Tehran Two-player games Minmax search algorithm Alpha-Beta pruning Games with chance.
Dr. Samy Abu Nasser Faculty of Engineering & Information Technology Artificial Intelligence.
© Franz Kurfess Games 1 CSC 480: Artificial Intelligence Dr. Franz J. Kurfess Computer Science Department Cal Poly.
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.
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.
Adversarial Search Chapter 6 Section 1 – 4. Search in an Adversarial Environment Iterative deepening and A* useful for single-agent search problems What.
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.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 5 Adversarial Search (Thanks Meinolf Sellman!)
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
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.
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.
EA C461 – Artificial Intelligence Adversarial Search
Adversarial Search Chapter 5.
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search.
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
Adversarial Search CS 171/271 (Chapter 6)
Games & Adversarial Search
Adversarial Search Chapter 6 Section 1 – 4.
Presentation transcript:

Games 1 Alpha-Beta Example [-∞, +∞] Range of possible values Do DF-search until first leaf

Games 2 Alpha-Beta Example (continued) [-∞,3] [-∞,+∞]

Games 3 Alpha-Beta Example (continued) [-∞,3] [-∞,+∞]

Games 4 Alpha-Beta Example (continued) [3,+∞] [3,3]

Games 5 Alpha-Beta Example (continued) [-∞,2] [3,+∞] [3,3] This node is worse for MAX

Games 6 Alpha-Beta Example (continued) [-∞,2] [3,14] [3,3][-∞,14],

Games 7 Alpha-Beta Example (continued) [−∞,2] [3,5] [3,3][-∞,5],

Games 8 Alpha-Beta Example (continued) [2,2] [−∞,2] [3,3]

Games 9 Alpha-Beta Example (continued) [2,2] [-∞,2] [3,3]

Games 10 Comments about Alpha-Beta Pruning  Pruning does not affect final results  Entire subtrees can be pruned  Alpha-beta pruning can look twice as far as minimax in the same amount of time

Games 11 Heuristic Evaluation Function (EVAL)  Idea: produce an estimate of the expected utility of the game from a given position.  Performance depends on quality of EVAL.  Must be able to differentiate between good and bad board states  Exact values not important

Games 12  Must be consistent with the utility function  values for terminal nodes (or at least their order) must be the same  should reflect the actual chances of winning  Frequently weighted linear functions are used  E = w 1 f 1 + w 2 f 2 + … + w n f n  combination of features, weighted by their relevance  Example in chess  Weights: Pawn=1, knight=bishop=3, rook=5, queen=9 Heuristic Evaluation Function (EVAL)

Games 13 Example Chess Score  Black has:  5 pawns, 1 bishop, 2 rooks  Score = 1*(5)+3*(1)+5*(2) = = 18 White has:  5 pawns, 1 rook  Score = 1*(5)+5*(1) = = 10 Overall scores for this board state: black = = 8 white = = -8

Games 14 Example: Tic-Tac-Toe  simple evaluation function E(s) = (rx + cx + dx) - (ro + co + do) where r,c,d are the numbers of row, column and diagonal lines still available; x and o are the pieces of the two players  1-ply lookahead  start at the top of the tree  evaluate all 9 choices for player 1  pick the maximum E-value  2-ply lookahead  also looks at the opponents possible move  assuming that the opponents picks the minimum E-value

Games 15 E(s12) = 2 E(s13) = 3 E(s14) = 2 E(s15) = 4 E(s16) = 2 E(s17) = 3 E(s18) = 2 E(s19) = 3 Tic-Tac-Toe 1-Ply XXX XXX XXX E(s11) = 3 E(s0) = Max{E(s11), E(s1n)} = Max{2,3,4} = 4

Games 16 E(s2:16) = -1 E(s2:15) 6 -6 = 0 E(s28) = 0 E(s27) = 1 E(s2:48) = 1 E(s2:47) = 2 E(s2:13) = 0 E(s2:9) = -1 E(s2:10) 5 -6 = -1 E(s2:11) = -1 E(s2:12) = -2 E(s2:14) = -1 E(s25) = 1 E(s21) = 1 E(s22) = 0 E(s23) = 1 E(s24) = -1 E(s26) = 0 E(s1:6) = 2 E(s1:7) = 3 E(s1:8) = 2 E(s1:9) = 3 E(s1:5) = 4 E(s1:3) = 3 E(s1:2) = 2 E(s1:1) = 3 E(s2:45) = 2 Tic-Tac-Toe 2-Ply XXX XXX XXX E(s0) = Max{E(s11), E(s1n)} = Max{2,3,4} = 4 E(s1:4) = 2 XOX O X O E(s2:41) = 1 E(s2:42) = 2 E(s2:43) = 1 E(s2:44) = 2 E(s2:46) = 1 OX O X O X O XX O X O X O X O XX O XOOXX O X O X O X O X O X O XOXOX O O

Games Checkers Case Study  initial board configuration  Black single on 20 single on 21 king on 31  Redsingle on 23 king on 22  evaluation function E(s) = (5 x 1 + x 2 ) - (5r 1 + r 2 ) where x 1 = black king advantage, x 2 = black single advantage, r 1 = red king advantage, r 2 = red single advantage

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > MAX MIN Checkers MiniMax Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 6 1 6 MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 1 1 1 MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 1 1 1  cutoff: no need to examine further branches MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 1 1 1 MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 1 1 1  cutoff: no need to examine further branches MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 1 1 1 MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1 0 1 0 MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1  -4 MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1  -4  cutoff: no need to examine further branches MAX MIN Checkers Alpha-Beta Example

Games > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  1  -8 MAX MIN Checkers Alpha-Beta Example

Games 29 Horizon Problem  Moves may have disastrous consequences in the future, but the consequences are not visible  Agent cannot see far enough into search space

Games 30 Games with Chance  In many games, there is a degree of unpredictability through random elements  throwing dice, card distribution, roulette wheel, …  This requires chance nodes in addition to the Max and Min nodes  branches indicate possible variations  each branch indicates the outcome and its likelihood (probability)

Games 31 Games with Chance chance nodes

Games 32 Decisions with Chance  The utility value of a position depends on the random element  the definite minimax value must be replaced by an expected value  Calculation of expected values  utility function for terminal nodes  for all other nodes  calculate the utility for each chance event  weigh by the chance that the event occurs  add up the individual utilities

Games 33 More interesting (but still trivial) game  Deal four cards face up  Player 1 chooses a card  Player 2 throws a die  If it’s a six, player 2 chooses a card, swaps it with player 1’s and keeps player 1’s card  If it’s not a six, player 2 just chooses a card  Player 1 chooses next card  Player 2 takes the last card

Games 34 Expectiminimax Diagram

Games 35 Expectiminimax Calculations

Games 36 Games and Computers  State of the art for some game programs  Chess  Checkers  Othello  Backgammon  Go

Games 37 Chess  Deep Blue, a special-purpose parallel computer, defeated the world champion Gary Kasparov in 1997  the human player didn’t show his best game  some claims that the circumstances were questionable  Deep Blue used a massive data base with games from the literature  Fritz, a program running on an ordinary PC, challenged the world champion Vladimir Kramnik to an eight-game draw in 2002  top programs and top human players are roughly equal

Games 38 Checkers  Arthur Samuel develops a checkers program in the 1950s that learns its own evaluation function  reaches an expert level stage in the 1960s  Chinook becomes world champion in 1994  human opponent, Dr. Marion Tinsley, withdraws for health reasons  Tinsley had been the world champion for 40 years  Chinook uses off-the-shelf hardware, alpha-beta search, end-games data base for six-piece positions

Games 39 Othello  Logistello defeated the human world champion in 1997  Many programs play far better than humans  smaller search space than chess  little evaluation expertise available

Games 40 Backgammon  TD-Gammon, neural-network based program, ranks among the best players in the world  improves its own evaluation function through learning techniques  search-based methods are practically hopeless  chance elements, branching factor

Games 41 Go  Humans play far better  large branching factor (around 360)  search-based methods are hopeless  Rule-based systems play at amateur level  The use of pattern-matching techniques can improve the capabilities of programs  difficult to integrate  $2,000,000 prize for the first program to defeat a top-level player

Games 42 Chapter Summary  Many game techniques are derived from search methods  The minimax algorithm determines the best move for a player by calculating the complete game tree  Alpha-beta pruning dismisses parts of the search tree that are provably irrelevant  An evaluation function gives an estimate of the utility of a state when a complete search is impractical  Chance events can be incorporated into the minimax algorithm by considering the weighted probabilities of chance events