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

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

2 person perfect information

ARTIFICIAL INTELLIGENCE (CS 370D)

Adversary Search. Ref: Chapter 5

mywbut.com Two agent games : alpha beta pruning

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

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

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

Game-playing AIs: Games and Adversarial Search I AIMA

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

Adversarial Search Aka Games

CS 2710 Foundations of AI. Lecture 9. Adversarial search. CS 2710 Foundations of AI. Game search

CPS 570: Artificial Intelligence Two-player, zero-sum, perfect-information Games

Artificial Intelligence Search III

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

CS 1571 Introduction to AI Lecture 12. Adversarial search. CS 1571 Intro to AI. Announcements

game tree complete all possible moves

CS 331: Artificial Intelligence Adversarial Search II. Outline

Adversarial Search 1

Games (adversarial search problems)

Adversarial Search: Game Playing. Reading: Chapter

More Adversarial Search

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

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

Algorithms for Data Structures: Search for Games. Phillip Smith 27/11/13

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

COMP219: Artificial Intelligence. Lecture 13: Game Playing

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

Artificial Intelligence. Minimax and alpha-beta pruning

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

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

CS 771 Artificial Intelligence. Adversarial Search

Game-Playing & Adversarial Search

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

Game Engineering CS F-24 Board / Strategy Games

Programming Project 1: Pacman (Due )

More on games (Ch )

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1

Artificial Intelligence

CMPUT 396 Tic-Tac-Toe Game

Adversarial Search (Game Playing)

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

CS188 Spring 2014 Section 3: Games

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

Data Structures and Algorithms

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

Lecture 33: How can computation Win games against you? Chess: Mechanical Turk

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

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

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

More on games (Ch )

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

CSE 332: Data Structures and Parallelism Games, Minimax, and Alpha-Beta Pruning. Playing Games. X s Turn. O s Turn. X s Turn.

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

Game Playing AI Class 8 Ch , 5.4.1, 5.5

Solving Problems by Searching: Adversarial Search

Artificial Intelligence Adversarial Search

Foundations of AI. 6. Board Games. Search Strategies for Games, Games with Chance, State of the Art

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

CS 188: Artificial Intelligence

Foundations of AI. 5. Board Games. Search Strategies for Games, Games with Chance, State of the Art. Wolfram Burgard and Luc De Raedt SA-1

CS 4700: Foundations of Artificial Intelligence

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

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

Ar#ficial)Intelligence!!

Game Playing. Philipp Koehn. 29 September 2015

Foundations of Artificial Intelligence

COMP9414: Artificial Intelligence Adversarial Search

Artificial Intelligence

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

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

Adversarial Search. CMPSCI 383 September 29, 2011

CS 188: Artificial Intelligence Spring Announcements

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

Foundations of Artificial Intelligence

4. Games and search. Lecture Artificial Intelligence (4ov / 8op)

Artificial Intelligence. Topic 5. Game playing

CSC384: Introduction to Artificial Intelligence. Game Tree Search

CS188 Spring 2010 Section 3: Game Trees

Game Playing State-of-the-Art

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

Game playing. Outline

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

Artificial Intelligence 1: game playing

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

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

Adversarial search (game playing)

Games and Adversarial Search

Game Playing Part 1 Minimax Search

CS 5522: Artificial Intelligence II

! HW5 now available! ! May do in groups of two.! Review in recitation! No fancy data structures except trie!! Due Monday 11:59 pm

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

ADVERSARIAL SEARCH. Chapter 5

Game Playing AI. Dr. Baldassano Yu s Elite Education

Artificial Intelligence Lecture 3

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

Artificial Intelligence

CS 188: Artificial Intelligence Spring 2007

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

Computer Game Programming Board Games

Transcription:

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

What kind of games? 2-player games Zero-sum games: If 1 is win, 0 is draw and -1 is loss, the total score at the end of a game is 0. No element of chance No dice, no card drawn Players are rational

Game Tree Nodes: possible states of the game Leaf nodes: final state: win, loss or draw Edges: moves

Searching Game Tree Game tree usually have very high branching factors and are very deep! tic-tac-toe: 9! = 350,000 nodes So it is not feasible to do any exhaustive search. prune the search tree use heuristics Another issue: two-player game means the opponent may interrupt your planned move! we must assume the opponent will attempt to make us lose.

General Minimax Search Try to maximize some score the opponent is trying to minimize. the score is usually the evaluation function e(). Minimax Search: Take turns in state-space search only assign evaluated value to the leaf nodes our turn (max node): pick branch resulting in position with maximal e() opponent s turn (min node): pick branch resulting in position with minimal e() Algorithm: minimax(player,board) if(game over in current board position) return winner children = all legal moves for player from this board if(max's turn) return maximal score of calling minimax on all the children else (min's turn) return minimal score of calling minimax on all the children

Bounded Minimax Problem: in order to apply Minimax search, the entire tree has to be examined! Solution: Only examine the tree to a certain depth! All nodes at this depth is considered to be leaf nodes and are evaluated using an evaluation function. n-move look-ahead: examining space after expanding n levels, or plys. expand state space by n plys evaluate state of each node at nth level propagate results up: if node represents computer's move, pick maximum; if it's opponent's move, pick minimum

Evaluation function Evaluation function: how likely to win the game from this state. Usually a weighted linear function Examples: Chess Score = 9q + 5r + 3b + 3n + p Where q,r,b,n and p represents #of queens, #of rooks, #of bishops, #of knights and #of pawns Tic-Tac-Toe Score = #of cells open to form a line If two computers are playing the game, how good the evaluation function is will decide the winner! O X

Tic-Tac-Toe Search Example e() = #of cells open to MAX # of cells open to MIN Look one step ahead! From Nilsson s textbook Step 1

Bounded Lookahead Example MAX MIN MAX MIN

Exercise: Minimax MAX MIN 4 3 9 1 80 2 3 5 2 7 6

Bounded Lookahead Issues When to cut off (decide it is a leaf)? cut off at a position where the next move is unlikely to cause a large change in the relative positions of the two players. Horizon problem: an extremely long sequence of moves that lead to a strong advantage for one player but go beyond the bounded search. solution: singular-extension heuristic: If the evaluation function of a move is much better than others, keep searching.

Pruning Problem: in order to apply Minimax search, the entire tree has to be examined! Solution: prune sections of the game tree. If a move is worse than another move already examined, further examining is pointless. MAX Does the opponent need to check the branch rooted at MAX node 7?

Alpha-Beta Pruning : the value of the best possible move you can make, that you have computed so far. : the value of the best possible move your opponent can make, that you have computed so far. alpha-beta pruning can reduce the number of nodes to be evaluated by half!

Alpha-Best Pruning Example >= DFS Traversal! <= <= <= >= >= Whenever determine value of node, propagate result up through tree. Before exploring child, check that exploring it could improve the results. Suppose value of MAX node is at least x; can ignore any (MIN) child with value x. Suppose value of MIN node is no more than y; can ignore any (MAX) child with value y.

Alpha-Beta Pruning Algorithm alpha-beta(current, alpha, beta) if isroot(current) alpha = -infinity; beta = infinity if isleaf(current) return e(current) if ismaxnode(current) alpha = max(alpha, alpha-beta(children, alpha, beta) if alpha >= beta cut off search below current if isminnode(current) beta = min(alpha, alpha-beta(children, alpha, beta) if alpha >= beta cut off search below current

Exercise: alpha-beta pruning MAX MIN 4 3 9 1 80 2 3 5 2 7 6

Summary 2-player game assumptions Game tree General minimax search bounded lookahead alpha-beta pruning