Intelligence Artificial Intelligence Ian Gent Games 1: Game Tree Search.

Slides:



Advertisements
Similar presentations
Chapter 6, Sec Adversarial Search.
Advertisements

Artificial Intelligence 5. Game Playing
Intelligence Artificial Intelligence Ian Gent Search: 3.
Intelligence Artificial Intelligence Ian Gent Search: 1.
Alpha-Beta Search. 2 Two-player games The object of a search is to find a path from the starting position to a goal position In a puzzle-type problem,
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Games & Adversarial Search
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CS 484 – Artificial Intelligence
University College Cork (Ireland) Department of Civil and Environmental Engineering Course: Engineering Artificial Intelligence Dr. Radu Marinescu Lecture.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
This time: Outline Game playing The minimax algorithm
Min-Max Trees Based on slides by: Rob Powers Ian Gent Yishay Mansour.
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.
Games & Adversarial Search Chapter 6 Section 1 – 4.
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.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Lecture 5 Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
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
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Alpha-beta Search. Two-player games zThe object of a search is to find a path from the starting position to a goal position zIn a puzzle-type problem,
Mark Dunlop, Computer and Information Sciences, Strathclyde University 1 Algorithms & Complexity 5 Games Mark D Dunlop.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
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.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Intelligence Artificial Intelligence Ian Gent Games 2: Alpha Beta.
Today’s Topics Playing Deterministic (no Dice, etc) Games –Mini-max –  -  pruning –ML and games? 1997: Computer Chess Player (IBM’s Deep Blue) Beat Human.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Adversarial Search 2 (Game Playing)
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
G51IAI Introduction to AI Andrew Parkes Game Playing 2: Alpha-Beta Search and General Issues.
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.
Search: Games & Adversarial Search Artificial Intelligence CMSC January 28, 2003.
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
Last time: search strategies
Iterative Deepening A*
CS 460 Spring 2011 Lecture 4.
Pengantar Kecerdasan Buatan
State Space 4 Chapter 4 Adversarial Games.
Games & Adversarial Search
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Alpha-Beta Search.
Games & Adversarial Search
NIM - a two person game n objects are in one pile
Alpha-Beta Search.
Instructor: Vincent Conitzer
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Alpha-Beta Search.
Artificial Intelligence
Minimax strategies, alpha beta pruning
Alpha-Beta Search.
Based on slides by: Rob Powers Ian Gent
Games & Adversarial Search
Alpha-Beta Search.
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Intelligence Artificial Intelligence Ian Gent Games 1: Game Tree Search

Intelligence Artificial Intelligence Part I :Game Trees Part II: MiniMax Part III: A bit of Alpha-Beta Game Tree Search

3 Perfect Information Games zUnlike Bridge, we consider 2 player perfect information games zPerfect Information: both players know everything there is to know about the game position yno hidden information (e.g. opponents hands in bridge) yno random events (e.g. draws in poker) ytwo players need not have same set of moves available yexamples are Chess, Go, Checkers, O’s and X’s zGinsberg made Bridge 2 player perfect information yby assuming specific random locations of cards ytwo players were North-South and East-West

4 Game Trees zA game tree is like a search tree ynodes are search states, with full details about a position xe.g. chessboard + castling/en passant information yedges between nodes correspond to moves yleaf nodes correspond to determined positions xe.g. Win/Lose/Draw xnumber of points for or against player yat each node it is one or other player’s turn to move

5 Game Trees  Search Trees zStrong similarities with 8s puzzle search trees ythere may be loops/infinite branches ytypically no equivalent of variable ordering heuristic x“variable” is always what move to make next zOne major difference with 8s puzzle yThe key difference is that you have an opponent! zCall the two players Max and Min yMax wants leaf node with max possible score xe.g. Win = +  yMin wants leaf node with min score, xe.g. Lose = - 

6 The problem with Game trees zGame trees are huge yO’s and X’s not bad, just 9! = 362,880 yCheckers/Draughts about yChess about yGo utterly ludicrous, e.g. 361!  zRecall from Search1 Lecture, yIt is not good enough to find a route to a win yHave to find a winning strategy yUnlike 8s/SAT/TSP, can’t just look for one leaf node xtypically need lots of different winning leaf nodes yMuch more of the tree needs to be explored

7 Coping with impossibility zIt is usually impossible to solve games completely yConnect 4 has been solved yCheckers has not been xwe’ll see a brave attempt later zThis means we cannot search entire game tree ywe have to cut off search at a certain depth xlike depth bounded depth first, lose completeness zInstead we have to estimate cost of internal nodes zDo so using a static evaluation function

8 Static evaluation zA static evaluation function should estimate the true value of a node ytrue value = value of node if we performed exhaustive search yneed not just be  /0/-  even if those are only final scores ycan indicate degree of position xe.g. nodes might evaluate to +1, 0, -10 zChildren learn a simple evaluation function for chess yP = 1, N = B = 3, R = 5, Q = 9, K = 1000 yStatic evaluation is difference in sum of scores ychess programs have much more complicated functions

9 O’s and X’s zA simple evaluation function for O’s and X’s is: yCount lines still open for maX, ySubtract number of lines still open for min yevaluation at start of game is 0 yafter X moves in center, score is +4 zEvaluation functions are only heuristics ye.g. might have score -2 but maX can win at next move xO - X x- O X x- - - zUse combination of evaluation function and search

10 MiniMax zAssume that both players play perfectly yTherefore we cannot optimistically assume player will miss winning response to our moves zE.g. consider Min’s strategy ywants lowest possible score, ideally -  ybut must account for Max aiming for +  yMin’s best strategy is: xchoose the move that minimises the score that will result when Max chooses the maximising move yhence the name MiniMax zMax does the opposite

11 Minimax procedure zStatically evaluate positions at depth d zFrom then on work upwards zScore of max nodes is the max of child nodes zScore of min nodes is the min of child nodes zDoing this from the bottom up eventually gives score of possible moves from root node yhence best move to make zCan still do this depth first, so space efficient

12 What’s wrong with MiniMax zMinimax is horrendously inefficient zIf we go to depth d, branching rate b, ywe must explore b d nodes zbut many nodes are wasted zWe needlessly calculate the exact score at every node zbut at many nodes we don’t need to know exact score ze.g. outlined nodes are irrelevant

13 Alpha-Beta search zAlpha-Beta =  zUses same insight as branch and bound zWhen we cannot do better than the best so far ywe can cut off search in this part of the tree zMore complicated because of opposite score functions zTo implement this we will manipulate alpha and beta values, and store them on internal nodes in the search tree

14 Alpha and Beta values zAt a M  x node we will store an alpha value ythe alpha value is lower bound on the exact minimax score ythe true value might be   yif we know Min can choose moves with score <  xthen Min will never choose to let Max go to a node where the score will be  or more zAt a Min node, we will store a beta value ythe beta value is upper bound on the exact minimax score ythe true value might be   zAlpha-Beta search uses these values to cut search

15 Alpha Beta in Action zWhy can we cut off search? zBeta = 1 < alpha = 2 where the alpha value is at an ancestor node zAt the ancestor node, Max had a choice to get a score of at least 2 (maybe more) zMax is not going to move right to let Min guarantee a score of 1 (maybe less)

16 Summary and Next Lecture zGame trees are similar to search trees ybut have opposing players zMinimax characterises the value of nodes in the tree ybut is horribly inefficient zUse static evaluation when tree too big zAlpha-beta can cut off nodes that need not be searched zNext Time: More details on Alpha-Beta