Theory and Practice of Artificial Intelligence

Similar documents
ARTIFICIAL INTELLIGENCE (CS 370D)

Adversarial Search. CS 486/686: Introduction to Artificial Intelligence

Foundations of Artificial Intelligence

Game-Playing & Adversarial Search

Adversarial Search. CS 486/686: Introduction to Artificial Intelligence

Adversarial Search and Game- Playing C H A P T E R 6 C M P T : S P R I N G H A S S A N K H O S R A V I

Programming Project 1: Pacman (Due )

2/5/17 ADVERSARIAL SEARCH. Today. Introduce adversarial games Minimax as an optimal strategy Alpha-beta pruning Real-time decision making

Set 4: Game-Playing. ICS 271 Fall 2017 Kalev Kask

Lecture 14. Questions? Friday, February 10 CS 430 Artificial Intelligence - Lecture 14 1

CS440/ECE448 Lecture 9: Minimax Search. Slides by Svetlana Lazebnik 9/2016 Modified by Mark Hasegawa-Johnson 9/2017

CS 771 Artificial Intelligence. Adversarial Search

CSE 40171: Artificial Intelligence. Adversarial Search: Game Trees, Alpha-Beta Pruning; Imperfect Decisions

Game Tree Search. CSC384: Introduction to Artificial Intelligence. Generalizing Search Problem. General Games. What makes something a game?

Adversarial Search. Human-aware Robotics. 2018/01/25 Chapter 5 in R&N 3rd Ø Announcement: Slides for this lecture are here:

Game Engineering CS F-24 Board / Strategy Games

Adversarial Search: Game Playing. Reading: Chapter

Adversary Search. Ref: Chapter 5

Adversarial Search. Soleymani. Artificial Intelligence: A Modern Approach, 3 rd Edition, Chapter 5

Multiple Agents. Why can t we all just get along? (Rodney King)

2 person perfect information

Adversarial Search (Game Playing)

Games (adversarial search problems)

CPS331 Lecture: Search in Games last revised 2/16/10

Adversarial Search 1

game tree complete all possible moves

CS 5522: Artificial Intelligence II

mywbut.com Two agent games : alpha beta pruning

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search

CS 331: Artificial Intelligence Adversarial Search II. Outline

Game Playing: Adversarial Search. Chapter 5

Game Playing Part 1 Minimax Search

Artificial Intelligence. Topic 5. Game playing

Artificial Intelligence

CSC 380 Final Presentation. Connect 4 David Alligood, Scott Swiger, Jo Van Voorhis

Ar#ficial)Intelligence!!

Game playing. Chapter 5, Sections 1 6

Foundations of Artificial Intelligence

Artificial Intelligence

Games and Adversarial Search

Outline. Game Playing. Game Problems. Game Problems. Types of games Playing a perfect game. Playing an imperfect game

Artificial Intelligence

Data Structures and Algorithms

Game-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA

CS188 Spring 2010 Section 3: Game Trees

CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5

CS 188: Artificial Intelligence

Games CSE 473. Kasparov Vs. Deep Junior August 2, 2003 Match ends in a 3 / 3 tie!

Unit-III Chap-II Adversarial Search. Created by: Ashish Shah 1

Game Playing AI Class 8 Ch , 5.4.1, 5.5

Game Playing State-of-the-Art

CS885 Reinforcement Learning Lecture 13c: June 13, Adversarial Search [RusNor] Sec

School of EECS Washington State University. Artificial Intelligence

Game Playing State-of-the-Art. CS 188: Artificial Intelligence. Behavior from Computation. Video of Demo Mystery Pacman. Adversarial Search

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter Read , Skim 5.7

Artificial Intelligence 1: game playing

CS188 Spring 2010 Section 3: Game Trees

Foundations of AI. 6. Adversarial Search. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard & Bernhard Nebel

Artificial Intelligence. 4. Game Playing. Prof. Bojana Dalbelo Bašić Assoc. Prof. Jan Šnajder

Contents. Foundations of Artificial Intelligence. Problems. Why Board Games?

Announcements. Homework 1. Project 1. Due tonight at 11:59pm. Due Friday 2/8 at 4:00pm. Electronic HW1 Written HW1

CS 4700: Foundations of Artificial Intelligence

Last update: March 9, Game playing. CMSC 421, Chapter 6. CMSC 421, Chapter 6 1

CSC384: Introduction to Artificial Intelligence. Game Tree Search

Lecture 5: Game Playing (Adversarial Search)

Adversarial Search and Game Playing

Game Playing. Why do AI researchers study game playing? 1. It s a good reasoning problem, formal and nontrivial.

Artificial Intelligence

Foundations of Artificial Intelligence

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro) 1

CMPUT 396 Tic-Tac-Toe Game

Game Tree Search. Generalizing Search Problems. Two-person Zero-Sum Games. Generalizing Search Problems. CSC384: Intro to Artificial Intelligence

CS-E4800 Artificial Intelligence

Documentation and Discussion

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter , 5.7,5.8

Pengju

COMP219: Artificial Intelligence. Lecture 13: Game Playing

CSE 473: Artificial Intelligence. Outline

Adversarial Search and Game Playing. Russell and Norvig: Chapter 5

COMP9414: Artificial Intelligence Adversarial Search

Adversarial Search. CMPSCI 383 September 29, 2011

Tree representation Utility function

CS440/ECE448 Lecture 11: Stochastic Games, Stochastic Search, and Learned Evaluation Functions

Adversarial Search and Game Theory. CS 510 Lecture 5 October 26, 2017

Adversarial Search. Read AIMA Chapter CIS 421/521 - Intro to AI 1

Game Playing Beyond Minimax. Game Playing Summary So Far. Game Playing Improving Efficiency. Game Playing Minimax using DFS.

CS 188: Artificial Intelligence

CSC242: Intro to AI. Lecture 8. Tuesday, February 26, 13

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing

CS 4700: Artificial Intelligence

Game playing. Chapter 5. Chapter 5 1

Game Playing State of the Art

CSE 473: Artificial Intelligence Fall Outline. Types of Games. Deterministic Games. Previously: Single-Agent Trees. Previously: Value of a State

Computer Game Programming Board Games

Game Playing State-of-the-Art CSE 473: Artificial Intelligence Fall Deterministic Games. Zero-Sum Games 10/13/17. Adversarial Search

Game Playing. Philipp Koehn. 29 September 2015

More on games (Ch )

CITS3001. Algorithms, Agents and Artificial Intelligence. Semester 2, 2016 Tim French

Games and Adversarial Search II

Announcements. Homework 1 solutions posted. Test in 2 weeks (27 th ) -Covers up to and including HW2 (informed search)

Transcription:

Theory and Practice of Artificial Intelligence Games Daniel Polani School of Computer Science University of Hertfordshire March 9, 2017 All rights reserved. Permission is granted to copy and distribute these slides in full or in part for purposes of research, education as well as private use, provided that author, affiliation and this notice is retained. Some external illustrations may be copyrighted and are included here under fair use for educational illustration only. Use as part of home- and coursework is only allowed with express permission by the responsible tutor and, in this case, is to be appropriately referenced. Theory and Practice of Artificial Intelligence 25 / 150

Games More Precisely: two-person (not multi-person; no gang-ups) perfect information (no card games) deterministic (no backgammon) alternating moves (no rock/scissors/paper) zero-sum (no prisoner s dilemma) games Theory and Practice of Artificial Intelligence 26 / 150

Game Structure Conditions: game is over when terminal position reached where game ends (no successor moves). Possible Outcomes: consider win/loss/draw. Other, intermediate outcomes also possible. Theory and Practice of Artificial Intelligence 27 / 150

Game State Structure Game: game position terminal won position terminal lost non-terminal won us-to-move (player A) them-to-move (player B) Theory and Practice of Artificial Intelligence 28 / 150

Position Utilities Motivation: since, in general, game trees are too big to be completely solved, use a utility (value) function to indicate which positions are more promising than another. Implication: quality of a game state characterized by its value (utility) U, a real-valued number Note: promising subtrees are indicated by a high value of U for starting states. Theory and Practice of Artificial Intelligence 29 / 150

Position Utilities II Note: the true value U of a position indicates the state of the position won/lost/draw, e.g. U = 100: current position allows player A to win (on optimal game from both sides) U = 100: current position is lost for player A (on optimal game from both sides) U = 0: position is a draw (no player can force a win) Theory and Practice of Artificial Intelligence 30 / 150

Minimax Principle 4 MIN 1 4 1 2 6 4 static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 31 / 150

Minimax Principle (Main Variation) 4 MIN 1 4 1 2 6 4 static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 32 / 150

Minimax view of utilities Consider: U(P), the utility of a position Let: S(P) = {P 1, P 2,..., P n } be the set of successors for position P Minimax Utility: define U static (P) if P terminal, i.e. S(P) = {} max U(P) = U(P i) if P is a -to-move position P i S(P) min U(P i) if P is a MIN-to-move position P i S(P) Theory and Practice of Artificial Intelligence 33 / 150

The Alpha-Beta Algorithm Observation: sometimes we know a move is not good and will never be covered in that case, the exact utility of the node is not needed α-β principle: search for the utility of a position but only if in the interval [α, β] if it is outside, its exact value is not important, we will be prevented from taking that path anyway Illustration: see following slides Theory and Practice of Artificial Intelligence 34 / 150

The Alpha-Beta Algorithm [, ] MIN static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 35 / 150

The Alpha-Beta Algorithm [, ] MIN [4, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 36 / 150

The Alpha-Beta Algorithm [, ] MIN static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 37 / 150

The Alpha-Beta Algorithm [, ] MIN [, 4] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 38 / 150

The Alpha-Beta Algorithm [, ] MIN [, 4] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 39 / 150

The Alpha-Beta Algorithm [, ] MIN [, 4] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 40 / 150

The Alpha-Beta Algorithm [, ] MIN [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 41 / 150

The Alpha-Beta Algorithm [4, ] MIN [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 42 / 150

The Alpha-Beta Algorithm [4, ] MIN [2, ] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 43 / 150

The Alpha-Beta Algorithm [4, ] MIN [2, 2] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 44 / 150

The Alpha-Beta Algorithm [4, ] MIN [, 2] [2, 2] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 45 / 150

The Alpha-Beta Algorithm [4, ] MIN [, 2] [2, 2] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 46 / 150

The Alpha-Beta Algorithm MIN [, 2] [2, 2] [5, ] static values 1 1 1 2 6 5 4 1 Theory and Practice of Artificial Intelligence 47 / 150

Alpha-Beta Algorithm: Properties α: worst guaranteed utility for (and best achievable value for MIN) β: worst guaranteed utility for MIN (and best achievable value for ) Good Enough Utility: a utility U(P, α, β) is a utility such that U(P, α, β) < α U(P, α, β) = U(P) In Particular: U(P,, ) = U(P) if U(P) < α if α U(P) β U(P, α, β) > β if U(P) > β. Remark: in the best case, this reduces the search branching factor from b for minimax to b Thus: can search twice as deeply as with minimax with the same evaluation effort Theory and Practice of Artificial Intelligence 48 / 150

Further Improvements 1 limitation of move selection 2 heuristic value function (cutoff before final state) 3 quiescence heuristics Theory and Practice of Artificial Intelligence 49 / 150

Further Improvements 1 limitation of move selection 2 heuristic value function (cutoff before final state) 3 quiescence heuristics 4 endgame algorithm Theory and Practice of Artificial Intelligence 49 / 150

Further Improvements 1 limitation of move selection 2 heuristic value function (cutoff before final state) 3 quiescence heuristics 4 endgame algorithm 5 UCT Monte Carlo Tree Search Theory and Practice of Artificial Intelligence 49 / 150

Game-Playing to the End: Idea End Games: consider game with only win/loss 2 players us and them playing alternatively solution: win for us R11 S14 won P Q1 Q2 Q... Qk R12 R13 Interpretation: game is won if solution tree exists, i.e. tree begins with an us node: there is a choice for us leading to an them node: such that all possible choices for them lead to an us node: and so on until Goal: successful solution (win) is found Theory and Practice of Artificial Intelligence 50 / 150

Interpretation It means: us has won (solution tree) if it is either in a winning position or it can always choose a move leading to a losing position of them; i.e. a position such that all moves that them can choose lead to a winning position of us (i.e. again to a solution tree). Note: us does not have to have a solution tree. Either them could have a solution tree (in which us loses) or neither of them have, so none of the players can force a win. Yes, I treat us as singular player and not as pluralis majestatis. Theory and Practice of Artificial Intelligence 51 / 150

Endgame Algorithm Endgame Algorithm: for us 1 consider final (0-step) winning positions for us 2 compute 1-step losing positions for them, i.e. all positions for them from which all immediate successors lead to a 0-step winning position for us 3 compute 2-step winning positions for us, i.e. all positions where us can choose one immediate successor to lead to a 1-step losing position for them 4 compute 3-step losing positions for them, i.e. all positions for them where all successors lead to a less-than-3 (i.e. 2- or 0-) winning position for us. 5 and so on, until no more new positions are collected or maximum depth are exhausted Result: if no maximum depth limit, the final outcome is a list of winning positions for us (with maximum depths) a list of losing positions for them (with maximum depths) and a list of tied positions Theory and Practice of Artificial Intelligence 52 / 150