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

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

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

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

Adversary Search. Ref: Chapter 5

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

mywbut.com Two agent games : alpha beta pruning

Game Engineering CS F-24 Board / Strategy Games

Artificial Intelligence

Data Structures and Algorithms

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

Artificial Intelligence

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

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

Monday, February 2, Is assigned today. Answers due by noon on Monday, February 9, 2015.

ARTIFICIAL INTELLIGENCE (CS 370D)

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

2 person perfect information

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

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

More on games (Ch )

More on games (Ch )

Game-playing AIs: Games and Adversarial Search I AIMA

Adversarial Search: Game Playing. Reading: Chapter

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

Artificial Intelligence Adversarial Search

Games (adversarial search problems)

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

Wednesday, February 1, 2017

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

Ar#ficial)Intelligence!!

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

If a pawn is still on its original square, it can move two squares or one square ahead. Pawn Movement

Solving Problems by Searching: Adversarial Search

CMPUT 396 Tic-Tac-Toe Game

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

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

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

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

A Simple Pawn End Game

COMP219: Artificial Intelligence. Lecture 13: Game Playing

Adversarial Search 1

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

Artificial Intelligence. Minimax and alpha-beta pruning

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

More Adversarial Search

Artificial Intelligence Search III

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

Adversarial Search. CMPSCI 383 September 29, 2011

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence

Programming Project 1: Pacman (Due )

An End Game in West Valley City, Utah (at the Harman Chess Club)

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

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

Artificial Intelligence. Topic 5. Game playing

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

Artificial Intelligence Lecture 3

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

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

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

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

CS 331: Artificial Intelligence Adversarial Search II. Outline

Game Playing AI. Dr. Baldassano Yu s Elite Education

game tree complete all possible moves

Unit. The double attack. Types of double attack. With which pieces? Notes and observations

Games and Adversarial Search

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

Adversarial Search Aka Games

Game-Playing & Adversarial Search

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

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

Movement of the pieces

Game Playing State-of-the-Art

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

CS 5522: Artificial Intelligence II

Game Tree Search 1/6/17

Game Playing. Philipp Koehn. 29 September 2015

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

CS 188: Artificial Intelligence Spring Announcements

CS 771 Artificial Intelligence. Adversarial Search

UNIT 13A AI: Games & Search Strategies

Artificial Intelligence

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

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

Adversarial Search Lecture 7

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

CS 188: Artificial Intelligence

Adversarial search (game playing)

Artificial Intelligence 1: game playing

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

CSC384: Introduction to Artificial Intelligence. Game Tree Search

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

COMP9414: Artificial Intelligence Adversarial Search

Chapter 1: Positional Play

Adversarial Search (Game Playing)

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

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

! 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. Read AIMA Chapter CIS 421/521 - Intro to AI 1

Transcription:

Course 9 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 1. 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. 12 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-12 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-12 3 =

Evaluation: bottom-up MAX 1 MIN 1

Evaluation: bottom-up MAX 1 MIN 1

Evaluation: bottom-up MAX 1 MIN 1-2

Evaluation: bottom-up MAX 1 MIN 1-2

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

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

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

Evaluation: bottom-up MAX choses the best move for them 1 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 1 MAX 1 MIN 1 1 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(val1, val2, player) begin if player = MAX then return max(val1, val2); else return min(val1, val2); end The initial call: min-max(,max,2)

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

Evaluation: bottom-up s MAX 1 1 min-max(,min,1) 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 1 s 1-1 MIN min-max(,min,1) 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 1 s 1 MIN min-max(,max,) if (depth = ) then return score(state);

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

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

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

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

The Alpha-Beta method MAX 1 MIN 1 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 1 MIN 1 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 1 MIN The generation can now be stopped! 1 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 1-2 1 MAX 1 MIN 1 1 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(val1, val2, player) begin if player = MAX then return max(val1, val2); else return min(val1, val2); end The initial call: alpha-beta (,MAX,2)

Solving P8: the chess game Choose a state-score function give values to pieces evaluate a state pawn = 1pt knight & bishop = 3pt rook = 5pt queen = 9pt king = more valuable than all of the other pieces combined dynamic change of values: in the endgame the king is more powerful than a bishop or knight but less powerful than a rook. advanced pawns are more valuable than those on their initial squares, coordination between pieces (e.g. a pair of bishops usually coordinate better than a bishop and a knight), type of position (e.g. knights are generally better in closed positions with many pawns while bishops are more powerful in open positions)

Develop instantaneous game trees Compute short-term actions develop the game tree from the current position for a given depth use MIN-MAX and alpha-beta to choose the best move

Tactics Simple one-move or two-move tactical actions: threats, exchanges of material, double attacks, etc. implement tactical moves (see https://en.wikipedia.org/wiki/chess#fundamentals_of_tactics)

Strategies Setting up goals and long-term plans Control the center and centralization The pawn structure (https://en.wikipedia.org/wiki/ Pawn_structure), king safety, control of key squares or groups of squares

Interface Explain why a move is better than another by visually showing short-term engagements by generating explanations in natural language invent a controlled language and parameterize it generate sentences that read the sequence of movements of a game