COMP4031Artificial Intelligence for Games and Puzzles1 The Shape of a Game Tree Fragment Standard  -  is an algorithm which performs the same computation.

Slides:



Advertisements
Similar presentations
Anthony Cozzie. Quite possibly the nerdiest activity in the world But actually more fun than human chess Zappa o alpha-beta searcher, with a lot of tricks.
Advertisements

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.
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.
For Friday Finish chapter 5 Program 1, Milestone 1 due.
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.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
CS 484 – Artificial Intelligence
Prepare for 4x4x4 tic-tac-toe
Search in AI.
Applied Neuro-Dynamic Programming in the Game of Chess James Gideon.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Search Strategies.  Tries – for word searchers, spell checking, spelling corrections  Digital Search Trees – for searching for frequent keys (in text,
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Minimax and Alpha-Beta Reduction Borrows from Spring 2006 CS 440 Lecture Slides.
This time: Outline Game playing The minimax algorithm
Using Search in Problem Solving
Intelligence for Games and Puzzles1 Berliner’s 1979 B* Algorithm: Motivations The B* algorithm.
Intelligence for Games and Puzzles1 Minimax to fixed depth Where the game tree is too large.
Game Playing CSC361 AI CSC361: Game Playing.
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.
Adversarial Search: Game Playing Reading: Chess paper.
Artificial Intelligence for Games and Puzzles1 Artificially Narrow Alpha & Beta AlphaBeta cuts off the.
Games & Adversarial Search Chapter 6 Section 1 – 4.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
Intelligence for Games and Puzzles1 Berliner’s 1979 B* Algorithm: Motivations The B* algorithm.
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
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 Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
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.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Traditional game playing 2 player adversarial (win => lose) based on search but... huge game trees can't be fully explored.
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.
For Wednesday Read chapter 7, sections 1-4 Homework: –Chapter 6, exercise 1.
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 Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
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.
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.
Adversarial Search Chapter 6 Section 1 – 4. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time.
Adversarial Search 2 (Game Playing)
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
Parallel Programming in Chess Simulations Part 2 Tyler Patton.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
PENGANTAR INTELIJENSIA BUATAN (64A614)
Two-player Games (2) ZUI 2013/2014
Dakota Ewigman Jacob Zimmermann
Games & Adversarial Search
Games & Adversarial Search
Games & Adversarial Search
NIM - a two person game n objects are in one pile
The Alpha-Beta Procedure
Based on slides by: Rob Powers Ian Gent
Artificial Intelligence
Games & Adversarial Search
Games & Adversarial Search
Unit II Game Playing.
Presentation transcript:

COMP4031Artificial Intelligence for Games and Puzzles1 The Shape of a Game Tree Fragment Standard  -  is an algorithm which performs the same computation as minimax for a given tree - avoiding generating useless parts of that tree. Quiescence Search can be seen as a method for defining the shape of a tree by means other than truncating it at a fixed depth. Quiescence Search can be used as an evaluation function at the leaves of an  -  search (or any other for that matter, even itself: Second Order Quiescence). It allows further search to be used as if it were a static evaluation function. Null-Move Quiescence Search generates at least a fringe of null-moves one ply beyond the normal fixed depth of the tree (though null moves are very cheap)

COMP4031Artificial Intelligence for Games and Puzzles2 Null Move Quiescence as an Evaluation Function NMQuiesce (real lower, real upper) /* initially - , +  */ {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles3 Animation of Null-Move Quiescence Search Nodes in search tree generally have six attributes: After consideration of a node is complete, collapse it to: Integers, not reals, will be used for simplicity. Whose MoveLower boundUpper bound Value ProducedBest ValueTemporary Value Whose Move Value Produced

COMP4031Artificial Intelligence for Games and Puzzles4 What is the value of the position? NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score} W -- ++

COMP4031Artificial Intelligence for Games and Puzzles5 Generate null move W -- ++ B -- ++  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles6 Generate null move and evaluate it W -- ++ B -- ++ +0  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles7 Use that evaluation W -- ++ -0 B +0  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles8 Since 0 < + , generate 1st real move W -- ++ -0 B +0  B -- 0 K-h3 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles9 Start with null move W -- ++ -0 B +0  B -- 0 K-h3 W0 ++  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles10 Statically evaluate W -- ++ -0 B +0  B -- 0 K-h3 W0 ++ 0  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles11 Use that evaluation W -- ++ -0 B +0  B -- 0 0 K-h3 W 0  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles12 Since “best 0” <= “upper 0”, W -- ++ -0 B +0  B -- 0 0 K-h3 W 0  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles13 Since “best 0” <= “upper 0”, immediately return 0 W -- ++ -00 B +0  B 0 W 0  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles14 0 = 0, and 0 < + , so generate next move available W -- ++ -00 B +0  B 0 W 0  B -- 0 NxP NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles15 Obtain null-move evaluation W -- ++ -00 B +0  B 0 W 0  B -- 0 NxP W +1  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles16 Since “upper 0” > “best -1”, try 1st move W -- ++ -00 B +0  B 0 W 0  B -- 0 NxP W +1  W0+1+1 K-g7 NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles17 Obtain null-move evaluation W -- ++ -00 B +0  B 0 W 0  B -- 0 NxP W +1  W0+1+1 K-g7 B  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles18 Now “best +1” >= “upper +1”, W -- ++ -00 B +0  B 0 W 0  B -- 0 NxP W +1  W0+1+1 K-g7 B  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles19 Now “best +1” >= “upper +1”, so return value +1 W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W K-g7 B  NMQuiesce (real lower, real upper) {real Temp, Best; makenull(); Score:= - realevaluationfunction( - upper, - lower) unmakenull(); for every move M {if Score>=upper then Return Score; makemove(M); Temp:= - NMQuiesce( - upper, - best); unmakemove(); Score:=Max(Score,Temp)} Return Score}

COMP4031Artificial Intelligence for Games and Puzzles20 Try another move W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W0+1 BxN

COMP4031Artificial Intelligence for Games and Puzzles21 Null move evaluation W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2 

COMP4031Artificial Intelligence for Games and Puzzles22 “best -2” < “upper +1”, so off again … W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2 

COMP4031Artificial Intelligence for Games and Puzzles23 Try a move W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2  B+2 K-h3

COMP4031Artificial Intelligence for Games and Puzzles24 Use null move evaluation, test, return W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2  B+2 K-h3 W -2

COMP4031Artificial Intelligence for Games and Puzzles25 Try another move W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2  B W -2 B +2 P-f4 W -2

COMP4031Artificial Intelligence for Games and Puzzles26 Try all moves in turn W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2  B W -2 B +2 K-g1 W -2 B +2 W -2

COMP4031Artificial Intelligence for Games and Puzzles27 Eventually settling on a value W -- ++ -00 B +0  B 0 W 0  B -- 0 +1 NxP W +1  W B  W BxN B +2  B W -2 B +2 K-g1 W -2 B +2 W -2

COMP4031Artificial Intelligence for Games and Puzzles28.. Which is returned W -- ++ -00 B +0  B 0 W 0  B -- 0 +2 NxP W +1  W B  W -2 BxN B +2  B W -2 B +2 K-g1 W -2 B +2 W -2

COMP4031Artificial Intelligence for Games and Puzzles29.. Which is returned, compared W -- ++ -00 B +0  B 0 W 0  B -- 0 +2 NxP W +1  W B  W -2 BxN B +2  B W -2 B +2 K-g1 W -2 B +2 W -2

COMP4031Artificial Intelligence for Games and Puzzles30.. Which is returned, compared, found to be better W -- ++ -00 B +0  B 0 W 0  B -- 0 +2 NxP W +1  W B  W -2 BxN B +2  B W -2 B +2 K-g1 W -2 B +2 W -2

COMP4031Artificial Intelligence for Games and Puzzles31 All other black moves are considered, (null not shown) W -- ++ -00 B +0  B 0 W 0  B -- 0 +2 NxP W +1  W B  W -2 B-a3 B +2  B W -2 B +2 W -2 B +2 W -2 W -- ++ 0

COMP4031Artificial Intelligence for Games and Puzzles32 Eventually determining a value W -- ++ -0-2 B +0  B 0 W 0  B +2 NxP W +1  W B  W -2 B-a3 B +2  B W -2 B +2 W -2 B +2 W -2 W

COMP4031Artificial Intelligence for Games and Puzzles33 Demonstrating that that capture is not good W -- ++ -0-2 B +0  B 0 W 0  B +2 W +1  W B  W -2 B +2  B W -2 B +2 W -2 B +2 W -2 W

COMP4031Artificial Intelligence for Games and Puzzles34 Other moves are considered (null again not shown) W -- ++ -00 B +0  B 0 W 0  B -- 0 +2 W +1  W B  W -2 B +2  B W -2 B +2 W -2 B +2 W -2 W B -- 0 00 N-c3

COMP4031Artificial Intelligence for Games and Puzzles35 Eventually determining a value for the initial position W -- ++ 0-00 B +0  B 0 W 0  B -- 0 +2 W +1  W B  W -2 B +2  B W -2 B +2 W -2 B +2 W -2 W B 0 N-c3

COMP4031Artificial Intelligence for Games and Puzzles36 Null-Move values as bounds The value determined for every node arises originally as the result of an evaluation of a null move. These evaluations - assuming the position is not zugzwang - are properly thought of as providing (lower) bounds on the value of a position. (Not to be confused with alpha and beta - achievable and hope - which are bounds on the range of values one is interested in exploring.) “The value of this position is at least N” is more reliable than “The value of this position is N” The value of the topmost node arises not from one evaluation providing one bound, but from two or more opposing evaluations providing touching bounds.

COMP4031Artificial Intelligence for Games and Puzzles37 Touching bounds The smallest possible tree for null-move quiescence:

COMP4031Artificial Intelligence for Games and Puzzles38 Quiescence as Evaluation The sort of evaluation performed by QUIESCE is to be performed at every leaf node of a MINIMAX (or AlphaBeta) search.

COMP4031Artificial Intelligence for Games and Puzzles39 Second Order Quiescence Since Quiescence Search can be regarded as an evaluation function, it can be used as such within another quiescence search: wherever the main quiescence search generates and evaluates a null move, that evaluation is performed using quiescence search with the real evaluation function.

COMP4031Artificial Intelligence for Games and Puzzles40 Evaluations that produce bounds on values Null moves may be regarded as producing a lower bound on a position’s value. A quiescence search that is terminated early - for example, by being restricted in terms of the depth of tree it may build or the number of nodes it may generate - may produce a “fat value” - a combination of A reliable lower bound (assuming no zugzwang) A reliable upper bound (assuming no zugzwang) Possibly, an unreliable value in between Fat values may also be produced by other means, for instance a pairing of a pessimistic evaluation function and an optimistic one. Some search algorithms, eg Berliner’s B* algorithm, work with value ranges rather than point values. More on B* another day …

COMP4031Artificial Intelligence for Games and Puzzles41 Bounds on values of interest to a search The AlphaBeta tree search algorithm uses its parameters  (achievable) and  (hope) to cut off search of parts of the game tree which cannot affect the minimaxed value ultimately found at the root. Once it is determined that a subtree’s value falls outside certain bounds, it can be abandoned. Conventionally, AlphaBeta is started off (at a root node) in an agnostic manner:  =-  and  =+  corresponds to having no idea what the value of the position is. Some interesting algorithms use an AlphaBeta search with different  and  : using a narrower search window in the expectation of getting more cutoffs. Aspiration Search NegaScout & PVS (Principal Variation Search) Scout MTD(f)