Rules of the game. chess checkers tic-tac-toe...

Similar documents
Rules of the game. chess checkers tic-tac-toe...

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

mywbut.com Two agent games : alpha beta pruning

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

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

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

Game Engineering CS F-24 Board / Strategy Games

Adversary Search. Ref: Chapter 5

ARTIFICIAL INTELLIGENCE (CS 370D)

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

2 person perfect information

Data Structures and Algorithms

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

Adversarial Search 1

Adversarial Search: Game Playing. Reading: Chapter

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

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

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

Games (adversarial search problems)

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

Artificial Intelligence. Minimax and alpha-beta pruning

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

Artificial Intelligence

Artificial Intelligence Lecture 3

Artificial Intelligence Adversarial Search

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

game tree complete all possible moves

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

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

CMPUT 396 Tic-Tac-Toe Game

Game Playing AI. Dr. Baldassano Yu s Elite Education

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

Game Tree Search 1/6/17

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina

Board Game AIs. With a Focus on Othello. Julian Panetta March 3, 2010

Artificial Intelligence 1: game playing

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

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

CS 771 Artificial Intelligence. Adversarial Search

COMP9414: Artificial Intelligence Adversarial Search

Programming Project 1: Pacman (Due )

Game-Playing & Adversarial Search

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

Adversarial Search (Game Playing)

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

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

Game-playing AIs: Games and Adversarial Search I AIMA

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard

16.410/413 Principles of Autonomy and Decision Making

Game Playing. Garry Kasparov and Deep Blue. 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM.

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

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

Artificial Intelligence

More on games (Ch )

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

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

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

CS 188: Artificial Intelligence Spring Announcements

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

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

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

CSC384: Introduction to Artificial Intelligence. Game Tree Search

Solving Problems by Searching: Adversarial Search

Game Playing State-of-the-Art

CS 4700: Foundations of Artificial Intelligence

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

Adversarial Search and Game Playing

Game Playing AI Class 8 Ch , 5.4.1, 5.5

CS 5522: Artificial Intelligence II

CS 188: Artificial Intelligence

1 Introduction. 1.1 Game play. CSC 261 Lab 4: Adversarial Search Fall Assigned: Tuesday 24 September 2013

CS188 Spring 2014 Section 3: Games

Artificial Intelligence

Computer Game Programming Board Games

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

More on games (Ch )

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

CSE 473: Artificial Intelligence. Outline

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

Adversarial search (game playing)

CS 4700: Artificial Intelligence

A Tic Tac Toe Learning Machine Involving the Automatic Generation and Application of Heuristics

Announcements. CS 188: Artificial Intelligence Spring Game Playing State-of-the-Art. Overview. Game Playing. GamesCrafters

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

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

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

The game of Reversi was invented around 1880 by two. Englishmen, Lewis Waterman and John W. Mollett. It later became

CS2212 PROGRAMMING CHALLENGE II EVALUATION FUNCTIONS N. H. N. D. DE SILVA

Using Neural Network and Monte-Carlo Tree Search to Play the Game TEN

Adverserial Search Chapter 5 minmax algorithm alpha-beta pruning TDDC17. Problems. Why Board Games?

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

Adversarial Search Lecture 7

Math 152: Applicable Mathematics and Computing

CS 188: Artificial Intelligence

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

Adversarial Search Aka Games

Game Playing Part 1 Minimax Search

Game-Playing & Adversarial Search Alpha-Beta Pruning, etc.

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

Ar#ficial)Intelligence!!

Transcription:

Course 8 Games

Rules of the game Two players: MAX and MIN Both have as goal to win the game Only one can win or else it will be a draw In the initial modeling there is no chance (but it can be simulated) Examples: chess checkers tic-tac-toe...

The tic-tac-toe game MAX plays with Xs MIN plays with Os

MAX The tic-tac-toe game

The tic-tac-toe game MIN

MAX The tic-tac-toe game

The tic-tac-toe game MIN

MAX The tic-tac-toe game

The tic-tac-toe game MIN

MAX The tic-tac-toe game

The tic-tac-toe game MIN

The tic-tac-toe game MAX Draw!

The tic-tac-toe game

MAX The tic-tac-toe game

The tic-tac-toe game MIN

MAX The tic-tac-toe game

The tic-tac-toe game MIN

MAX The tic-tac-toe game

The tic-tac-toe game MIN

MAX The tic-tac-toe game

MAX wins The tic-tac-toe game

Representation as an AI problem. Problem versus instance 2. The state space: a state: the position on the board of the signs between two moves the size of the space: 3 9 3. Representing a state: a 3x3 matrix 4. Representing a transition algorithmical (in the present approach) 5. How is it controled the evolution of the game? the MIN-MAX method the ALPHA-BETA method

The game tree MAX a simetry class

The game tree MAX MIN

The game tree MAX MIN

The game tree MAX MIN

The game tree MAX MIN

MAX wins: + The value of a state

MIN wins: - The value of a state

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. 2 34 56 78

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. 8-2 34 5 = 3

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players...

Evaluating a state A state is better if it opens up more win possibilities until the end of the game. An example of an evaluation function: the value of the state is the difference between the number of lines that MAX could fill in till the end of the game and those that MIN could fill in till the end of the game. Lines having no sign could be taken by any of the players... 3 - = 3

Evaluating a state 2-2 3 =

Evaluation: bottom-up MAX MIN

Evaluation: bottom-up MAX MIN

Evaluation: bottom-up MAX MIN -2

Evaluation: bottom-up MAX MIN -2

Evaluation: bottom-up -2 MAX MIN 2-2

Evaluation: bottom-up -2 MAX MIN 2-2

Evaluation: bottom-up -2 MAX MIN 2-2

Evaluation: bottom-up MAX choses the best move for them Developping the search space for a depth of 2 yields the conclusion that the player at move has a better chance to win if they occupy the center -2 MAX MIN 2 MAX thinks: MIN choses the best move for them = the worst move for me -2

The MIN-MAX method function min-max(state, player, depth) begin if (depth = ) then return score(state); val = worst(player); while (there are still states to generate) begin generate a state -> s; val <- back-up-compare(val, min-max(s, not(player), depth), player); // the following instruction reduces the search space in case a win is reached in one of the generated states: if (val = -worst(player)) return(val); end return(val); end function worst(player) begin if player = MAX then return - ; else return + ; end funtion back-up-compare(val, val2, player) begin if player = MAX then return max(val, val2); else return min(val, val2); end The initial call: min-max(,max,2)

Evaluation: bottom-up MAX MIN val=; player = MAX; depth=; while (there are still states to generate) begin generate a state -> s;... end

Evaluation: bottom-up s MAX min-max(,min,) MIN val=; player = MAX; depth=2; while (there are still states to generate) begin generate a state -> s; val <- back-up-compare(val, min-max(s, not(player), depth), player); if (val = -worst(player)) return(val); end

Evaluation: bottom-up MAX s - MIN min-max(,min,) val = worst(player); val= while (there are still states to generate) begin generate a state -> s; val <- back-up-compare(val, min-max(s, not(player), depth), player); if (val = -worst(player)) return(val); end

Evaluation: bottom-up MAX s MIN min-max(,max,) if (depth = ) then return score(state);

Evaluation: bottom-up MAX s MIN min-max(,min,) -2 val= ; player=min; val <- back-up-compare(val,, player); if (val = -worst(player)) return(val); end

Evaluation: bottom-up MAX s MIN min-max(,min,) -2 val= ; player=min; val <- back-up-compare(val,, player); if (val = -worst(player)) return(val); end -2

Evaluation: bottom-up MAX s MIN min-max(,min,) -2 val= ; player=min; val <- back-up-compare(val,, player); if (val = -worst(player)) return(val); end -2

Evaluation: bottom-up MAX s MIN min-max(,min,) -2 val= ; player=min; val <- back-up-compare(val,, player); if (val = -worst(player)) return(val); end -2

The Alpha-Beta method MAX MIN A moment in the development of the tree when a peculier situation occurs: At this level a maximum is computed. The value of the first node on this level borders the range of possible values of the root node to the left!

The Alpha-Beta method MAX MIN A moment in the development of the tree when a peculier situation occurs: La At acest this level nivel a se maximum calculează is computed. un maxim. The value of the first node on this level borders the range of possible values of the root node to the left! At this level a minimum is computed. Any value of the parent node could be less then or equal to.

The Alpha-Beta method MAX MIN The generation can now be stopped! It can not influence eny longer the value of the root node. A moment in the development of the tree when a peculier situation occurs: La At acest this level nivel a se maximum calculează is computed. un maxim. The value of the first node on this level borders the range of possible values of the root node to the left! At this level a minimum is computed. Any value of the parent node could be less then or equal to.

The Alpha-Beta method -2 MAX MIN 2-2

The Alpha-Beta method function alpha-beta(state, player, depth) begin if (depth = ) then return score(state); val = worst(player); while (there are still states to generate) begin generate a state -> s; newval <- alpha-beta(s, not(player), depth); if player=max & newval val then return(newval); else if player=min & newval val then return(newval); else val! back-up-compare(val, min-max(s, not(player), depth), player); // the following instruction reduces the search space in case a win is reached in one of the generated states: if (val = -worst(player)) return(val); end return(val); end function worst(player) begin if player = MAX then return - ; else return + ; end function back-up-compare(val, val2, player) begin if player = MAX then return max(val, val2); else return min(val, val2); end The initial call: alpha-beta (,MAX,2)