CS 171 Discussion Session Week 3

Slides:



Advertisements
Similar presentations
Adversarial Search Reference: “Artificial Intelligence: A Modern Approach, 3 rd ed” (Russell and Norvig)
Advertisements

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.
Search in AI.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
Search Strategies.  Tries – for word searchers, spell checking, spelling corrections  Digital Search Trees – for searching for frequent keys (in text,
This time: Outline Game playing The minimax algorithm
Using Search in Problem Solving
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
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.
Monotonicity Admissible Search: “That finds the shortest path to the Goal” Monotonicity: local admissibility is called MONOTONICITY This property ensures.
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.
CISC 235: Topic 6 Game Trees.
Minimax.
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.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
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.
CIS 350 – I Game Programming Instructor: Rolf Lakaemper.
1 Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game.
Game Playing Why do AI researchers study game playing?
Adversarial Search and Game-Playing
Last time: search strategies
Alpha-Beta Pruning.
Iterative Deepening A*
PENGANTAR INTELIJENSIA BUATAN (64A614)
CS 460 Spring 2011 Lecture 4.
Adversarial Search and Game Playing (Where making good decisions requires respecting your opponent) R&N: Chap. 6.
Pengantar Kecerdasan Buatan
Adversarial Search.
Game Playing.
State Space 4 Chapter 4 Adversarial Games.
David Kauchak CS52 – Spring 2016
CSCI 5582 Artificial Intelligence
Game Playing in AI by: Gaurav Phapale 05 IT 6010
Games & Adversarial Search
Artificial Intelligence
Game playing.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
Games & Adversarial Search
Games & Adversarial Search
Kevin Mason Michael Suggs
NIM - a two person game n objects are in one pile
Artificial Intelligence
The Alpha-Beta Procedure
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Search and Game Playing
Minimax strategies, alpha beta pruning
Mini-Max search Alpha-Beta pruning General concerns on games
Based on slides by: Rob Powers Ian Gent
Artificial Intelligence
Adversarial Search and Game Playing Examples
Games & Adversarial Search
Adversarial Search CMPT 420 / CMPG 720.
Adversarial Search CS 171/271 (Chapter 6)
Games & Adversarial Search
Minimax strategies, alpha beta pruning
Games & Adversarial Search
Unit II Game Playing.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

CS 171 Discussion Session Week 3 Jia Chen jiac5@uci.edu

Quiz 1 return First letter of your last name A - H:  Kyoungwon Kim (Office hours Tuesday 9-10am in ICS 424A) I - P:  Zephyr Yao (Office hours Monday 9-10am in ICS 424F) Q - Z:  Dongxu Zhao (Office hours Friday 9-10am in ICS 424F) If time conflicts, send email to the Reader to which you are assigned, and to a Reader with whom you do not have a time conflict, asking to be reassigned.  

Schedule Games (Minimax, Alpha-beta pruning) CSP

Game playing as a search problem Idea: we cannot predict the behavior of the opponent, so we consider the worst case (the opponent makes the “optimal” move) Generate game tree Apply utility function to leaves Bottom up calculation At root, choose node leading to the highest value

Minimax

Can we do better? When we visit this green node, we know the value of its parent is min(2, some other numbers), which cannot be larger than 2

Alpha Beta Pruning

At root alpha = -Inf, beta = Inf, MIN Node MIN tests if new value is less than current value, so v = Inf [any number is < Inf] MIN updates beta (and use alpha from its parent MAX to prune children) MIN can prune if alpha >= beta MAX Node MAX tests if new value is greater than current value, so v=-Inf [any number is > -Inf] MAX updates Alpha (and use beta from its parent MIN to prune children) MAX can prune if alpha >= beta

alpha=-Inf beta=Inf v=-Inf (always less than any number) MAX

v=-Inf alpha=-Inf v=+Inf beta=Inf MIN

v=-Inf v=+Inf v=-Inf alpha=-Inf beta=Inf MAX Compare 1 and v=-Inf → 1 > v=-Inf → update v=1, alpha=1 Test if alpha >= beta; 1 >=Inf? No Compare 2 and v=1 → 2 > v=1 → update v=2, alpha=2 Test if alpha >= beta; 2 >=Inf? No

v=-Inf alpha=-Inf beta=2 v=2 v=2 MIN Compare 2 and v=+Inf → 2 < +inf → update v=2, alpha=-Inf, beta = 2

v=-Inf v=2 v=-Inf alpha=-Inf beta=2 MAX Compare 3 and v=-Inf → 3 > -Inf → update v = 3, update alpha = 3 Test if alpha >= beta → 3 >=2 Yes! Prune “MAX: Even if I return 3 or something greater than 3, MIN will enforce me to get only 2. I should check if there is a possibility of getting Lower score than 2 under this branch”

v=-Inf v=2 alpha=-Inf beta=2 v=3 Min Compare new value 3 and current best 2 3 > 2 ? No → keep current v=2 and beta = 2

v=-Inf v=2 v=-Inf alpha=-Inf beta=2 MAX Compare 5 and v=-Inf 5 > v=-Inf, update v=5 and update alpha=5 Test if v alpha >= beta → 5 >=2 Prune!

v=-Inf v=2 alpha=-Inf beta=2 v=5 MIN Compare 5 and v=2 Keep v=2

v=2 alpha=2 beta=Inf v=2 MAX Compare 2 (from MIN) and v=-Inf 2 > -Inf? → yes → update v=2, update alpha=2

v=2 alpha=2 beta=Inf alpha=2 v=Inf beta=Inf MIN

v=2 alpha=2 beta=Inf alpha=2 v=Inf beta=Inf alpha=2 v=7 beta=Inf MAX Compare 1 and v=-Inf 1 > -Inf → update v=1, update alpha? 1 > 2 No → alpha is 2 Test if alpha >= beta( Inf) ? No Compare 7 and v=1 7 > 1 → update v=7, update alpha 7 > 2 Yes→ alpha is 7 Test if alpha >=Inf? No

v=2 alpha=2 beta=Inf alpha=2 v=7 beta=7 v=7 MIN Compare 7 from MAX and v=Inf 7 < INF → update v=7, update beta = 7 Test if alpha >= beta? 2 >=7 No (if MAX branch was (1,2) then beta would become 2 Then alpha >= 2? Yes) MIN updates beta from INF to 7 If beta <= alpha then Prune not!! 7 <=2

v=2 alpha=2 beta=Inf alpha=2 v=7 beta=7 v=7 MIN MIN player wishes to search for some score which is less than or equal to 2 from the search space below (B)

v=2 alpha=2 beta=Inf v=7 v=7 v=8 alpha=8 MAX update v=8; alpha=8 Test if alpha >=beta; 8 >=7 Yes, Because…. MIN (B) will choose 7 anyway beta=7

v=2 alpha=2 beta=Inf v=7 v=7 v=8 v=8 alpha=2 (from B) MAX v =3; alpha=3 Test if alpha >= beta; 3 >=7 No MAX player cannot prune v=8; alpha = 8 Could test… but no more nodes.. beta=7

v=7 alpha=7 beta=Inf v=INF alpha=7 beta=Inf v=7 v=8 v=8 MIN

v=7 alpha=7 beta=Inf v=INF alpha=7 beta=Inf v=1 v=7 v=8 v=8 alpha=7 beta=Inf MAX Update v as 0; alpha remains 7; Alpha >= beta? 7>= INF? No Update v as 1; alpha remains 7;

v=7 alpha=7 beta=Inf v=INF alpha=7 beta=1 v=1 v=7 v=8 v=8 alpha=7 MIN Update v as 1; update beta as 1 Test if alpha >= beta; 7>=1 Yes, Prune beta=Inf

CSP

CSP

TFFF

NW BC SA all 2 values remaining

B [from 3 possible choice R,G,B] R (ON 1 NU1 SA 1 total 3) G (ON 1 NU 1 SA 1 total 3) B (ON 1 NU 1 SA 0 total 2)