Game Playing Part 1 Minimax Search

Similar documents
ARTIFICIAL INTELLIGENCE (CS 370D)

Game Theory Lecturer: Ji Liu Thanks for Jerry Zhu's slides

Adversarial Search 1

Game playing. Chapter 5. Chapter 5 1

Game-playing AIs: Games and Adversarial Search I AIMA

Adversarial Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 9 Feb 2012

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

Game playing. Chapter 5, Sections 1 6

Game Engineering CS F-24 Board / Strategy Games

CS 331: Artificial Intelligence Adversarial Search. Games we will consider

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

Games we will consider. CS 331: Artificial Intelligence Adversarial Search. What makes games hard? Formal Definition of a Game.

Computer Science and Software Engineering University of Wisconsin - Platteville. 4. Game Play. CS 3030 Lecture Notes Yan Shi UW-Platteville

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

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

Game-Playing & Adversarial Search

Artificial Intelligence. Minimax and alpha-beta pruning

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

game tree complete all possible moves

Foundations of Artificial Intelligence

Adversarial Search. Rob Platt Northeastern University. Some images and slides are used from: AIMA CS188 UC Berkeley

Playing Games. Henry Z. Lo. June 23, We consider writing AI to play games with the following properties:

CS 4700: Artificial Intelligence

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

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

Artificial Intelligence Adversarial Search

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

Game playing. Outline

Game playing. Chapter 6. Chapter 6 1

Ar#ficial)Intelligence!!

CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH. Santiago Ontañón

Programming Project 1: Pacman (Due )

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

Game Playing AI Class 8 Ch , 5.4.1, 5.5

CSE 573: Artificial Intelligence

Game Playing. Dr. Richard J. Povinelli. Page 1. rev 1.1, 9/14/2003

Game playing. Chapter 6. Chapter 6 1

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

Games vs. search problems. Game playing Chapter 6. Outline. Game tree (2-player, deterministic, turns) Types of games. Minimax

Adversary Search. Ref: Chapter 5

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

CS 188: Artificial Intelligence Spring 2007

Game Playing: Adversarial Search. Chapter 5

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

Adversarial Search. CMPSCI 383 September 29, 2011

ADVERSARIAL SEARCH. Chapter 5

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

Module 3. Problem Solving using Search- (Two agent) Version 2 CSE IIT, Kharagpur

Theory and Practice of Artificial Intelligence

Adversarial Search. Robert Platt Northeastern University. Some images and slides are used from: 1. CS188 UC Berkeley 2. RN, AIMA

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

CS 380: ARTIFICIAL INTELLIGENCE

mywbut.com Two agent games : alpha beta pruning

V. Adamchik Data Structures. Game Trees. Lecture 1. Apr. 05, Plan: 1. Introduction. 2. Game of NIM. 3. Minimax

CSE 473: Artificial Intelligence. Outline

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

Game Playing State-of-the-Art

Computer Game Programming Board Games

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence

Adversarial Search: Game Playing. Reading: Chapter

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

INF September 25, The deadline is postponed to Tuesday, October 3

Games vs. search problems. Adversarial Search. Types of games. Outline

Outline. Game playing. Types of games. Games vs. search problems. Minimax. Game tree (2-player, deterministic, turns) Games

Adversarial Search Aka Games

CS 188: Artificial Intelligence

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

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

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

Adversarial search (game playing)

Games (adversarial search problems)

CS188 Spring 2010 Section 3: Game Trees

Artificial Intelligence

Data Structures and Algorithms

CSC384: Introduction to Artificial Intelligence. Game Tree Search

2 person perfect information

CS 5522: Artificial Intelligence II

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

Artificial Intelligence

Artificial Intelligence. Topic 5. Game playing

Adversarial Search and Game Playing

Artificial Intelligence

Adversarial Search (Game Playing)

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 4: Search 3.

16.410/413 Principles of Autonomy and Decision Making

CSE 573: Artificial Intelligence Autumn 2010

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

CS 188: Artificial Intelligence Spring Announcements

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram

CS188 Spring 2010 Section 3: Game Trees

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

Game Playing State of the Art

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

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

CS510 \ Lecture Ariel Stolerman

CS 188: Artificial Intelligence

More on games (Ch )

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

CS325 Artificial Intelligence Ch. 5, Games!

Artificial Intelligence

Transcription:

Game Playing Part 1 Minimax Search Yingyu Liang yliang@cs.wisc.edu Computer Sciences Department University of Wisconsin, Madison [based on slides from A. Moore http://www.cs.cmu.edu/~awm/tutorials, C. Dyer, J. Skrentny, Jerry Zhu] slide 1

Sadly, not these games (not in this course) slide 2

Overview two-player zero-sum discrete finite deterministic game of perfect information Minimax search Alpha-beta pruning Large games two-player zero-sum discrete finite NON-deterministic game of perfect information slide 3

Two-player zero-sum discrete finite deterministic games of perfect information Definitions: Zero-sum: one player s gain is the other player s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls no chance Perfect information: each player can see the complete game state. No simultaneous decisions. slide 4

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? [Shamelessly copied from Andrew Moore] slide 5

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? [Shamelessly copied from Andrew Moore] slide 6

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player s gain is the other player s loss. Does not mean fair. Discrete: states and decisions have discrete values [Shamelessly copied from Andrew Moore] slide 7

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player s gain is the other player s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions [Shamelessly copied from Andrew Moore] slide 8

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player s gain is the other player s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls no chance [Shamelessly copied from Andrew Moore] slide 9

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player s gain is the other player s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls no chance Perfect information: each player can see the complete game state. No simultaneous decisions. [Shamelessly copied from Andrew Moore] slide 10

Which of these are: Two-player zero-sum discrete finite deterministic games of perfect information? Zero-sum: one player s gain is the other player s loss. Does not mean fair. Discrete: states and decisions have discrete values Finite: finite number of states and decisions Deterministic: no coin flips, die rolls no chance Perfect information: each player can see the complete game state. No simultaneous decisions. [Shamelessly copied from Andrew Moore] slide 11

II-Nim: Max simple game There are 2 piles of sticks. Each pile has 2 sticks. Each player takes one or more sticks from one pile. The player who takes the last stick loses. (ii, ii) slide 13

II-Nim: Max simple game There are 2 piles of sticks. Each pile has 2 sticks. Each player takes one or more sticks from one pile. The player who takes the last stick loses. (ii, ii) Two players: Max and Min If Max wins, the score is ; otherwise Min s score is Max s Use Max s as the score of the game slide 14

Two players: Max and Min The game tree for II-Nim (ii ii) Max who is to move at this state Convention: score is w.r.t. the first player Max. Min s score = Max Max wants the largest score Min wants the smallest score slide 15

Two players: Max and Min The game tree for II-Nim (ii ii) Max Symmetry (i ii) = (ii i) (i ii) Min (- ii) Min Max wants the largest score Min wants the smallest score slide 16

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max Max wants the largest score Min wants the smallest score slide 17

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max Max wants the largest score Min wants the smallest score slide 18

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min Max wants the largest score Min wants the smallest score slide 19

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 20

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 21

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 22

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 23

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 24

Game theoretic value Game theoretic value (a.k.a. minimax value) of a node = the score of the terminal node that will be reached if both players play optimally. slide 25

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 26

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 27

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min - (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 28

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min - (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 29

Two players: Max and Min The game tree for II-Nim (ii ii) Max (i ii) Min - (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min Max wants the largest score Min wants the smallest score slide 30

Two players: Max and Min The game tree for II-Nim (ii ii) Max who is to move at this state Symmetry (i ii) = (ii i) (i ii) Min The first player always (- ii) Min loses, if the second player plays optimally (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min - 1 (- i) Min - 1 Convention: score is w.r.t. the first player Max. Min s score = Max Max wants the largest score Min wants the smallest score slide 31

Game theoretic value Game theoretic value (a.k.a. minimax value) of a node = the score of the terminal node that will be reached if both players play optimally. = The numbers we filled in. Computed bottom up In Max s turn, take the max of the children (Max will pick that maximizing action) In Min s turn, take the min of the children (Min will pick that minimizing action) Implemented as a modified version of DFS: minimax algorithm slide 32

Minimax algorithm function Max-Value(s) inputs: s: current state in game, Max about to play output: best-score (for Max) available from s if ( s is a terminal state ) then return ( terminal value of s ) else α := for each s in Succ(s) α := max( α, Min-value(s )) return α function Min-Value(s) output: best-score (for Min) available from s if ( s is a terminal state ) then return ( terminal value of s) else β := for each s in Succs(s) β := min( β, Max-value(s )) return β Time complexity? Space complexity? slide 33

Minimax algorithm function Max-Value(s) inputs: s: current state in game, Max about to play output: best-score (for Max) available from s if ( s is a terminal state ) then return ( terminal value of s ) else α := for each s in Succ(s) α := max( α, Min-value(s )) return α function Min-Value(s) output: best-score (for Min) available from s if ( s is a terminal state ) then return ( terminal value of s) else β := for each s in Succs(s) β := min( β, Max-value(s )) return β Time complexity? O(b m ) bad Space complexity? O(bm) slide 34

Minimax example max A min B C D 0 E max F G -5 H I 3 8 J K L 2 M min N 4 O P Q R S T U V 9-6 0 3 5-7 -9 max W -3 X -5 What are the game theoretic values? In particular, A s slide 35

Max surely loses! If Min not optimal, Which way? Why? Against a dumber opponent? (i ii) Min (ii ii) Max (- ii) Min (- ii) Max (i i) Max (- i) Max (- i) Max (- i) Min (- i) Min slide 37