Lab 11: GoFirst and Nim 12:00 PM, Nov 19, 2017

Size: px
Start display at page:

Download "Lab 11: GoFirst and Nim 12:00 PM, Nov 19, 2017"

Transcription

1 CS17 Integrated Introduction to Computer Science Hughes Contents Lab 11: GoFirst and Nim 12:00 PM, Nov 19, Prologue 1 2 Game Theory 1 3 Game Signature 2 4 GoFirst, A Game Module 3 5 Nim, A Game Module 4 6 Let s Play! 4 7 AI 5 1 Prologue While their owners are off learning magic and battling Voldemort, Hedwig and Pigwidgeon decide to pass the time by playing some snazzy terminal games developed just for them. Unfortunately, they are owls, and most owls do not know how to program. Hedwig asks you to help them by writing two games for them to play: GoFirst and Number in the Middle (Nim). Before we begin please copy over all of the files from /course/cs017/src/lab11 2 Game Theory For your Game project, you will implement a two-player, sequential, finite-action, deterministic, zero-sum game of perfect information. Let s define what that means: ˆ A sequential game is one in which only one player moves at a time. Monopoly is a sequential game; Rochambeau (i.e., rock-paper-scissors) is not. ˆ A finite-action game is one in which there is a finite number of legal moves available to a player when it is their turn to move. Battleship is a finite-action game; soccer is not. ˆ A deterministic game is one that does not depend at all on chance. Its progress is entirely a function of selected moves. Checkers is deterministic; backgammon is not. ˆ A zero-sum game is one in which what is good for one player is equally bad for the other, and vice versa. All the examples in this section are zero-sum games.

2 ˆ A game of perfect information is one in which both players witness the entire progression of the game. Chess is a game of perfect information; poker is not. In addition to implementing a game, you will also write a general purpose, artificially intelligent (AI) player that can play any game of this sort. Your AI player will solve a game using the minimax algorithm, together with a helper procedure that estimates the values of intermediate game states. GoFirst and Nim are both examples of two-player, sequential, finite-action, deterministic, zero-sum games of perfect information. GoFirst is essentially Tic-tac-toe on a one-by-one grid. On each turn, a player has the option to either go or pass. As you may have guessed, because there is only one space to fill, the first player to play go will win. For the CS 17 version of Nim, the players take turns removing matches from a pile of 21 matches. On each turn, the player whose turn it is takes one, two, or three matches. The player who takes the last match loses. In this lab, you will implement simple versions of GoFirst and Nim, with an AI player that doesn t even need to use minimax to play intelligently. 3 Game Signature First, you will design a game abstract data type (ADT). Your ADT will capture (much of) what is common to two-person, sequential, finite-action, deterministic, zero-sum games of perfect information. Game Signature Here is a start at a GAME signature: module type GAME = sig (* TYPES *) type which_player type state type move (* INITIAL VALUE *) val initial_state : state (* GAME LOGIC *) val legal_moves : state - > move list val next_state : state - > move - > state val estimate_value : state - > float... end This signature has three main components: ˆ Types: What does a player look like? What about a state, or a move? 2

3 player: Names the two players. state: Expresses the states of the game. What does the board look like, and whose turn is it? move: Describes the game s moves. ˆ Constructor: How do you construct a game? Specifically, what is the initial game state, before any moves have been made? initial_state: The initial game state. ˆ Game logic: These are the operations that define your game. legal_moves: Produces all the legal moves at a given state. next_state: Given a state and a move, produces the state that results from making that move. estimate_value: Associated with each state in a zero-sum game is a value. However, it is not always possible to compute such a value. For example, the value of the initial state in a two-player, zero-sum game is either + (a win for P1) or (a win for P2), but in Chess, this value is unknown. The procedure estimate_value computes an estimate of how good each state is. The lecture notes will more clearly explain this concept and how to approach writing this method. Your first task in this lab is to extend this signature to include other useful features, such as a way of prettily printing a game. For instance, in order to print out a specific player you could use val string_of_player : which_player ->string. Task: Add string_of_player, string_of_state, string_of_move, and move_of_string to your game signature with the correct types. 4 GoFirst, A Game Module Your next task is to write a module that implements this signature. implement the game of GoFirst. Here s a road map for how you might proceed: Specifically, you should 1. Write a template for a module that implements a testable version of GoFirst, starting like this: module ConcreteGoFirst = struct type which_player = P1 P2 type status = Win of which_player Draw Ongoing of which_player 3

4 type state =... type move = end For now, leave off the signature ascription, meaning : GAME, so that your code will compile. 2. Fill in the types for state and move. We have filled in the player and status types for you. What are the states in a game of GoFirst? To answer this, think about what you would need to record if you were in the middle of a game of GoFirst, and you intended to take a break and finish the game later. Your state type should encapsulate just these things. Once you have determined what is needed to represent a state in GoFirst, you can then go on to determine how to describe legal moves. That is, what will transition the game from one state to the next? 3. Add stubs for all of the procedures in the GAME signature. A stub is just a procedure header plus a body which does nothing useful, or reports an error. For example, here s a stub for the legal_moves procedure: let legal_moves a_state = failwith "not implemented" 4. The ConcreteGoFirst module is concrete. You should leave it as such so that your helpers are fully visible, and you can test them. But in addition, you should create a fully abstract GoFirst module, right below the definition of ConcreteGoFirst as follows: module GoFirst = (ConcreteGoFirst : GAME) ;; This will ensure that your GoFirst module implements your game signature. 5. Gradually fill in all of the stubs you just wrote until they re working. At this point, two human players should be able to play your game. (See Section 6 for instructions.) You ve reached a checkpoint! Please call over a lab TA to review your work. 5 Nim, A Game Module Now that you are done with GoFirst, Hedwig wants you to move on to Nim! Follow the same steps as in the section directly above to write another module that implements the GAME signature. This time however, you will implement the game of Nim in the provided /course/cs017/src/lab11/nim.ml file. Hint: When writing estimate_value, think about in what cases you are guaranteed to either win or to lose. For instance, if you have 4 matches, is there any case when you can win? 4

5 You ve reached a checkpoint! Please call over a lab TA to review your work. 6 Let s Play! Here is a player s signature. All a player does is choose its next move. module type PLAYER = sig (* given a state, and decides which legal move to make *) val next_move : Nim.state - > Nim.move end ;; There are two kinds of players in this world: human players and AI players. Both can be found in the /course/cs017/src/lab11/players.ml file. 1. The HumanPlayer makes its moves based on user input. We ve written most of this player for you because it uses some imperative language constructs. 1 Make the changes described in the comments to get it working! 2. The AIPlayer makes its moves based on artificial intelligence, which you will code soon. The Referee module is in charge of running games. It does so by constructing a HumanPlayer and a AIPlayer. It then lets you choose which kind of game to run. (* The Referee coordinates the other modules. * Invoke play_game to start playing a game. *) module Referee = struct (* Change these module names to what you've named them *) module Game = SimpleGame module Human : PLAYER with module Game := Game = HumanPlayer module AI : PLAYER with module Game := Game = AIPlayer... let play_game () = play... end The following line of code starts a game: Referee.play_game() Task: Play a few games of Nim against your partner. 1 By the end of CS 18, you will be able to write a human player all by yourself! 5

6 7 AI Annoyed by Hedwig winning all their games, Pigwidgeon wants a program that will help him always win. It is now up to you to write an AI that can defeat Hedwig. One nice thing about our simplified version of Nim is that there is a way to determine whether the current player will win or lose based solely on the number of matches left in the pile. What is this formula? Task: Play Nim a few times and try to discover this formula. (Call over the TAs if you need help.) Once you have the formula, you can define a perfect next_move procedure: i.e., one that will always win if possible. Hint: Don t forget that you can use estimate_value to estimate how good a specific state within the game is. Task: Write an AIPlayer module that implements the PLAYER signature and always plays an optimal move. Hint: Don t worry! This is way easier than it seems. See the comments in the players.ml file to see exactly what you have to do. Once a lab TA signs off on your work, you ve finished the lab! Congratulations! Before you leave, make sure both partners have access to the code you ve just written. Please let us know if you find any mistakes, inconsistencies, or confusing language in this or any other CS17document by filling out the anonymous feedback form: courses/cs017/feedback. 6

(Provisional) Lecture 31: Games, Round 2

(Provisional) Lecture 31: Games, Round 2 CS17 Integrated Introduction to Computer Science Hughes (Provisional) Lecture 31: Games, Round 2 10:00 AM, Nov 17, 2017 Contents 1 Review from Last Class 1 2 Finishing the Code for Yucky Chocolate 2 3

More information

Project 4: Game Due: 7:00 PM, Dec 6, 2017

Project 4: Game Due: 7:00 PM, Dec 6, 2017 CS17 Integrated Introduction to Computer Science Hughes Contents Project 4: Game Due: 7:00 PM, Dec 6, 2017 1 Introduction 1 2 Pick A Game! 2 3 Assignment 2 3.1 Game Signature and Module...............................

More information

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves.

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves. 1 Tutorial 1 1. Combinatorial games. Recall that a game is called a combinatorial game if it satisfies the following axioms. (i) There are 2 players. (ii) There are finite many possible positions. (iii)

More information

Homework 7: Subsets Due: 10:00 PM, Oct 24, 2017

Homework 7: Subsets Due: 10:00 PM, Oct 24, 2017 CS17 Integrated Introduction to Computer Science Hughes Homework 7: Subsets Due: 10:00 PM, Oct 24, 2017 Contents 1 Bookends (Practice) 2 2 Subsets 3 3 Subset Sum 4 4 k-subsets 5 5 k-subset Sum 6 Objectives

More information

game tree complete all possible moves

game tree complete all possible moves Game Trees Game Tree A game tree is a tree the nodes of which are positions in a game and edges are moves. The complete game tree for a game is the game tree starting at the initial position and containing

More information

Math 152: Applicable Mathematics and Computing

Math 152: Applicable Mathematics and Computing Math 152: Applicable Mathematics and Computing April 16, 2017 April 16, 2017 1 / 17 Announcements Please bring a blue book for the midterm on Friday. Some students will be taking the exam in Center 201,

More information

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

Lecture 33: How can computation Win games against you? Chess: Mechanical Turk 4/2/0 CS 202 Introduction to Computation " UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department Lecture 33: How can computation Win games against you? Professor Andrea Arpaci-Dusseau Spring 200

More information

CS 188: Artificial Intelligence Spring Game Playing in Practice

CS 188: Artificial Intelligence Spring Game Playing in Practice CS 188: Artificial Intelligence Spring 2006 Lecture 23: Games 4/18/2006 Dan Klein UC Berkeley Game Playing in Practice Checkers: Chinook ended 40-year-reign of human world champion Marion Tinsley in 1994.

More information

Grade 7/8 Math Circles Game Theory October 27/28, 2015

Grade 7/8 Math Circles Game Theory October 27/28, 2015 Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 7/8 Math Circles Game Theory October 27/28, 2015 Chomp Chomp is a simple 2-player game. There is

More information

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

CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5 CS 440 / ECE 448 Introduction to Artificial Intelligence Spring 2010 Lecture #5 Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri Topics Game playing Game trees

More information

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

V. Adamchik Data Structures. Game Trees. Lecture 1. Apr. 05, Plan: 1. Introduction. 2. Game of NIM. 3. Minimax Game Trees Lecture 1 Apr. 05, 2005 Plan: 1. Introduction 2. Game of NIM 3. Minimax V. Adamchik 2 ü Introduction The search problems we have studied so far assume that the situation is not going to change.

More information

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

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter Read , Skim 5.7 ADVERSARIAL SEARCH Today Reading AIMA Chapter Read 5.1-5.5, Skim 5.7 Goals Introduce adversarial games Minimax as an optimal strategy Alpha-beta pruning 1 Adversarial Games People like games! Games are

More information

CS 188: Artificial Intelligence Spring Announcements

CS 188: Artificial Intelligence Spring Announcements CS 188: Artificial Intelligence Spring 2011 Lecture 7: Minimax and Alpha-Beta Search 2/9/2011 Pieter Abbeel UC Berkeley Many slides adapted from Dan Klein 1 Announcements W1 out and due Monday 4:59pm P2

More information

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm Weight: 8% Individual Work: All assignments in this course are to be completed individually. Students are advised to read the guidelines

More information

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

Outline. Game Playing. Game Problems. Game Problems. Types of games Playing a perfect game. Playing an imperfect game Outline Game Playing ECE457 Applied Artificial Intelligence Fall 2007 Lecture #5 Types of games Playing a perfect game Minimax search Alpha-beta pruning Playing an imperfect game Real-time Imperfect information

More information

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

ADVERSARIAL SEARCH. Today. Reading. Goals. AIMA Chapter , 5.7,5.8 ADVERSARIAL SEARCH Today Reading AIMA Chapter 5.1-5.5, 5.7,5.8 Goals Introduce adversarial games Minimax as an optimal strategy Alpha-beta pruning (Real-time decisions) 1 Questions to ask Were there any

More information

ADVERSARIAL SEARCH. Chapter 5

ADVERSARIAL SEARCH. Chapter 5 ADVERSARIAL SEARCH Chapter 5... every game of skill is susceptible of being played by an automaton. from Charles Babbage, The Life of a Philosopher, 1832. Outline Games Perfect play minimax decisions α

More information

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

CS 2710 Foundations of AI. Lecture 9. Adversarial search. CS 2710 Foundations of AI. Game search CS 2710 Foundations of AI Lecture 9 Adversarial search Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square CS 2710 Foundations of AI Game search Game-playing programs developed by AI researchers since

More information

Programming Project 1: Pacman (Due )

Programming Project 1: Pacman (Due ) Programming Project 1: Pacman (Due 8.2.18) Registration to the exams 521495A: Artificial Intelligence Adversarial Search (Min-Max) Lectured by Abdenour Hadid Adjunct Professor, CMVS, University of Oulu

More information

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

CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH. Santiago Ontañón CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH Santiago Ontañón so367@drexel.edu Recall: Problem Solving Idea: represent the problem we want to solve as: State space Actions Goal check Cost function

More information

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

Board Game AIs. With a Focus on Othello. Julian Panetta March 3, 2010 Board Game AIs With a Focus on Othello Julian Panetta March 3, 2010 1 Practical Issues Bug fix for TimeoutException at player init Not an issue for everyone Download updated project files from CS2 course

More information

Game-Playing & Adversarial Search

Game-Playing & Adversarial Search Game-Playing & Adversarial Search This lecture topic: Game-Playing & Adversarial Search (two lectures) Chapter 5.1-5.5 Next lecture topic: Constraint Satisfaction Problems (two lectures) Chapter 6.1-6.4,

More information

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

Announcements. CS 188: Artificial Intelligence Spring Game Playing State-of-the-Art. Overview. Game Playing. GamesCrafters CS 188: Artificial Intelligence Spring 2011 Announcements W1 out and due Monday 4:59pm P2 out and due next week Friday 4:59pm Lecture 7: Mini and Alpha-Beta Search 2/9/2011 Pieter Abbeel UC Berkeley Many

More information

CS 188: Artificial Intelligence

CS 188: Artificial Intelligence CS 188: Artificial Intelligence Adversarial Search Instructor: Stuart Russell University of California, Berkeley Game Playing State-of-the-Art Checkers: 1950: First computer player. 1959: Samuel s self-taught

More information

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

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 Adversarial Search and Game- Playing C H A P T E R 6 C M P T 3 1 0 : S P R I N G 2 0 1 1 H A S S A N K H O S R A V I Adversarial Search Examine the problems that arise when we try to plan ahead in a world

More information

CS510 \ Lecture Ariel Stolerman

CS510 \ Lecture Ariel Stolerman CS510 \ Lecture04 2012-10-15 1 Ariel Stolerman Administration Assignment 2: just a programming assignment. Midterm: posted by next week (5), will cover: o Lectures o Readings A midterm review sheet will

More information

Adversarial Search Lecture 7

Adversarial Search Lecture 7 Lecture 7 How can we use search to plan ahead when other agents are planning against us? 1 Agenda Games: context, history Searching via Minimax Scaling α β pruning Depth-limiting Evaluation functions Handling

More information

CS 380: ARTIFICIAL INTELLIGENCE

CS 380: ARTIFICIAL INTELLIGENCE CS 380: ARTIFICIAL INTELLIGENCE ADVERSARIAL SEARCH 10/23/2013 Santiago Ontañón santi@cs.drexel.edu https://www.cs.drexel.edu/~santi/teaching/2013/cs380/intro.html Recall: Problem Solving Idea: represent

More information

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

Adversarial Search. Hal Daumé III. Computer Science University of Maryland CS 421: Introduction to Artificial Intelligence 9 Feb 2012 1 Hal Daumé III (me@hal3.name) Adversarial Search Hal Daumé III Computer Science University of Maryland me@hal3.name CS 421: Introduction to Artificial Intelligence 9 Feb 2012 Many slides courtesy of Dan

More information

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

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard CS 109: Introduction to Computer Science Goodney Spring 2018 Homework Assignment 4 Assigned: 4/2/18 via Blackboard Due: 2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard Notes: a. This is the fourth homework

More information

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

Playing Games. Henry Z. Lo. June 23, We consider writing AI to play games with the following properties: Playing Games Henry Z. Lo June 23, 2014 1 Games We consider writing AI to play games with the following properties: Two players. Determinism: no chance is involved; game state based purely on decisions

More information

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

CS 1571 Introduction to AI Lecture 12. Adversarial search. CS 1571 Intro to AI. Announcements CS 171 Introduction to AI Lecture 1 Adversarial search Milos Hauskrecht milos@cs.pitt.edu 39 Sennott Square Announcements Homework assignment is out Programming and experiments Simulated annealing + Genetic

More information

Game playing. Chapter 5. Chapter 5 1

Game playing. Chapter 5. Chapter 5 1 Game playing Chapter 5 Chapter 5 1 Outline Games Perfect play minimax decisions α β pruning Resource limits and approximate evaluation Games of chance Games of imperfect information Chapter 5 2 Types of

More information

A Brief Introduction to Game Theory

A Brief Introduction to Game Theory A Brief Introduction to Game Theory Jesse Crawford Department of Mathematics Tarleton State University April 27, 2011 (Tarleton State University) Brief Intro to Game Theory April 27, 2011 1 / 35 Outline

More information

Game Playing. Philipp Koehn. 29 September 2015

Game Playing. Philipp Koehn. 29 September 2015 Game Playing Philipp Koehn 29 September 2015 Outline 1 Games Perfect play minimax decisions α β pruning Resource limits and approximate evaluation Games of chance Games of imperfect information 2 games

More information

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

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina Conversion Masters in IT (MIT) AI as Representation and Search (Representation and Search Strategies) Lecture 002 Sandro Spina Physical Symbol System Hypothesis Intelligent Activity is achieved through

More information

CHECKMATE! A Brief Introduction to Game Theory. Dan Garcia UC Berkeley. The World. Kasparov

CHECKMATE! A Brief Introduction to Game Theory. Dan Garcia UC Berkeley. The World. Kasparov CHECKMATE! The World A Brief Introduction to Game Theory Dan Garcia UC Berkeley Kasparov Welcome! Introduction Topic motivation, goals Talk overview Combinatorial game theory basics w/examples Computational

More information

For slightly more detailed instructions on how to play, visit:

For slightly more detailed instructions on how to play, visit: Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! The purpose of this assignment is to program some of the search algorithms and game playing strategies that we have learned

More information

Game Playing AI Class 8 Ch , 5.4.1, 5.5

Game Playing AI Class 8 Ch , 5.4.1, 5.5 Game Playing AI Class Ch. 5.-5., 5.4., 5.5 Bookkeeping HW Due 0/, :59pm Remaining CSP questions? Cynthia Matuszek CMSC 6 Based on slides by Marie desjardin, Francisco Iacobelli Today s Class Clear criteria

More information

Artificial Intelligence Adversarial Search

Artificial Intelligence Adversarial Search Artificial Intelligence Adversarial Search Adversarial Search Adversarial search problems games They occur in multiagent competitive environments There is an opponent we can t control planning again us!

More information

Figure 1: A Checker-Stacks Position

Figure 1: A Checker-Stacks Position 1 1 CHECKER-STACKS This game is played with several stacks of black and red checkers. You can choose any initial configuration you like. See Figure 1 for example (red checkers are drawn as white). Figure

More information

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

Game Playing. Garry Kasparov and Deep Blue. 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM. Game Playing Garry Kasparov and Deep Blue. 1997, GM Gabriel Schwartzman's Chess Camera, courtesy IBM. Game Playing In most tree search scenarios, we have assumed the situation is not going to change whilst

More information

Adversarial Search (Game Playing)

Adversarial Search (Game Playing) Artificial Intelligence Adversarial Search (Game Playing) Chapter 5 Adapted from materials by Tim Finin, Marie desjardins, and Charles R. Dyer Outline Game playing State of the art and resources Framework

More information

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

Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu. Lecture 4: Search 3. Artificial Intelligence, CS, Nanjing University Spring, 2018, Yang Yu Lecture 4: Search 3 http://cs.nju.edu.cn/yuy/course_ai18.ashx Previously... Path-based search Uninformed search Depth-first, breadth

More information

Unit 12: Artificial Intelligence CS 101, Fall 2018

Unit 12: Artificial Intelligence CS 101, Fall 2018 Unit 12: Artificial Intelligence CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Explain the difference between procedural and declarative knowledge. Describe the

More information

Adversary Search. Ref: Chapter 5

Adversary Search. Ref: Chapter 5 Adversary Search Ref: Chapter 5 1 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans is possible. Many games can be modeled very easily, although

More information

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

Game Tree Search. CSC384: Introduction to Artificial Intelligence. Generalizing Search Problem. General Games. What makes something a game? CSC384: Introduction to Artificial Intelligence Generalizing Search Problem Game Tree Search Chapter 5.1, 5.2, 5.3, 5.6 cover some of the material we cover here. Section 5.6 has an interesting overview

More information

CS 771 Artificial Intelligence. Adversarial Search

CS 771 Artificial Intelligence. Adversarial Search CS 771 Artificial Intelligence Adversarial Search Typical assumptions Two agents whose actions alternate Utility values for each agent are the opposite of the other This creates the adversarial situation

More information

Contents. MA 327/ECO 327 Introduction to Game Theory Fall 2017 Notes. 1 Wednesday, August Friday, August Monday, August 28 6

Contents. MA 327/ECO 327 Introduction to Game Theory Fall 2017 Notes. 1 Wednesday, August Friday, August Monday, August 28 6 MA 327/ECO 327 Introduction to Game Theory Fall 2017 Notes Contents 1 Wednesday, August 23 4 2 Friday, August 25 5 3 Monday, August 28 6 4 Wednesday, August 30 8 5 Friday, September 1 9 6 Wednesday, September

More information

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

CS885 Reinforcement Learning Lecture 13c: June 13, Adversarial Search [RusNor] Sec CS885 Reinforcement Learning Lecture 13c: June 13, 2018 Adversarial Search [RusNor] Sec. 5.1-5.4 CS885 Spring 2018 Pascal Poupart 1 Outline Minimax search Evaluation functions Alpha-beta pruning CS885

More information

Game Playing: Adversarial Search. Chapter 5

Game Playing: Adversarial Search. Chapter 5 Game Playing: Adversarial Search Chapter 5 Outline Games Perfect play minimax search α β pruning Resource limits and approximate evaluation Games of chance Games of imperfect information Games vs. Search

More information

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

Set 4: Game-Playing. ICS 271 Fall 2017 Kalev Kask Set 4: Game-Playing ICS 271 Fall 2017 Kalev Kask Overview Computer programs that play 2-player games game-playing as search with the complication of an opponent General principles of game-playing and search

More information

Practice Midterm Exam 5

Practice Midterm Exam 5 CS103 Spring 2018 Practice Midterm Exam 5 Dress Rehearsal exam This exam is closed-book and closed-computer. You may have a double-sided, 8.5 11 sheet of notes with you when you take this exam. You may

More information

Game 0: One Pile, Last Chip Loses

Game 0: One Pile, Last Chip Loses Take Away Games II: Nim April 24, 2016 The Rules of Nim The game of Nim is a two player game. There are piles of chips which the players take turns taking chips from. During a single turn, a player can

More information

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

COMP219: COMP219: Artificial Intelligence Artificial Intelligence Dr. Annabel Latham Lecture 12: Game Playing Overview Games and Search COMP19: Artificial Intelligence COMP19: Artificial Intelligence Dr. Annabel Latham Room.05 Ashton Building Department of Computer Science University of Liverpool Lecture 1: Game Playing 1 Overview Last

More information

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

Announcements. CS 188: Artificial Intelligence Fall Local Search. Hill Climbing. Simulated Annealing. Hill Climbing Diagram CS 188: Artificial Intelligence Fall 2008 Lecture 6: Adversarial Search 9/16/2008 Dan Klein UC Berkeley Many slides over the course adapted from either Stuart Russell or Andrew Moore 1 Announcements Project

More information

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

Games vs. search problems. Game playing Chapter 6. Outline. Game tree (2-player, deterministic, turns) Types of games. Minimax Game playing Chapter 6 perfect information imperfect information Types of games deterministic chess, checkers, go, othello battleships, blind tictactoe chance backgammon monopoly bridge, poker, scrabble

More information

CS 4700: Foundations of Artificial Intelligence

CS 4700: Foundations of Artificial Intelligence CS 4700: Foundations of Artificial Intelligence selman@cs.cornell.edu Module: Adversarial Search R&N: Chapter 5 1 Outline Adversarial Search Optimal decisions Minimax α-β pruning Case study: Deep Blue

More information

Game playing. Chapter 6. Chapter 6 1

Game playing. Chapter 6. Chapter 6 1 Game playing Chapter 6 Chapter 6 1 Outline Games Perfect play minimax decisions α β pruning Resource limits and approximate evaluation Games of chance Games of imperfect information Chapter 6 2 Games vs.

More information

Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games

Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games May 17, 2011 Summary: We give a winning strategy for the counter-taking game called Nim; surprisingly, it involves computations

More information

Game playing. Chapter 6. Chapter 6 1

Game playing. Chapter 6. Chapter 6 1 Game playing Chapter 6 Chapter 6 1 Outline Games Perfect play minimax decisions α β pruning Resource limits and approximate evaluation Games of chance Games of imperfect information Chapter 6 2 Games vs.

More information

CS 188: Artificial Intelligence Spring 2007

CS 188: Artificial Intelligence Spring 2007 CS 188: Artificial Intelligence Spring 2007 Lecture 7: CSP-II and Adversarial Search 2/6/2007 Srini Narayanan ICSI and UC Berkeley Many slides over the course adapted from Dan Klein, Stuart Russell or

More information

CSE 573: Artificial Intelligence Autumn 2010

CSE 573: Artificial Intelligence Autumn 2010 CSE 573: Artificial Intelligence Autumn 2010 Lecture 4: Adversarial Search 10/12/2009 Luke Zettlemoyer Based on slides from Dan Klein Many slides over the course adapted from either Stuart Russell or Andrew

More information

Adversarial search (game playing)

Adversarial search (game playing) Adversarial search (game playing) References Russell and Norvig, Artificial Intelligence: A modern approach, 2nd ed. Prentice Hall, 2003 Nilsson, Artificial intelligence: A New synthesis. McGraw Hill,

More information

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

CPS 570: Artificial Intelligence Two-player, zero-sum, perfect-information Games CPS 57: Artificial Intelligence Two-player, zero-sum, perfect-information Games Instructor: Vincent Conitzer Game playing Rich tradition of creating game-playing programs in AI Many similarities to search

More information

CSC 110 Lab 4 Algorithms using Functions. Names:

CSC 110 Lab 4 Algorithms using Functions. Names: CSC 110 Lab 4 Algorithms using Functions Names: Tic- Tac- Toe Game Write a program that will allow two players to play Tic- Tac- Toe. You will be given some code as a starting point. Fill in the parts

More information

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

Outline. Game playing. Types of games. Games vs. search problems. Minimax. Game tree (2-player, deterministic, turns) Games utline Games Game playing Perfect play minimax decisions α β pruning Resource limits and approximate evaluation Chapter 6 Games of chance Games of imperfect information Chapter 6 Chapter 6 Games vs. search

More information

Sequential games. We may play the dating game as a sequential game. In this case, one player, say Connie, makes a choice before the other.

Sequential games. We may play the dating game as a sequential game. In this case, one player, say Connie, makes a choice before the other. Sequential games Sequential games A sequential game is a game where one player chooses his action before the others choose their. We say that a game has perfect information if all players know all moves

More information

CS151 - Assignment 2 Mancala Due: Tuesday March 5 at the beginning of class

CS151 - Assignment 2 Mancala Due: Tuesday March 5 at the beginning of class CS151 - Assignment 2 Mancala Due: Tuesday March 5 at the beginning of class http://www.clubpenguinsaraapril.com/2009/07/mancala-game-in-club-penguin.html The purpose of this assignment is to program some

More information

Games (adversarial search problems)

Games (adversarial search problems) Mustafa Jarrar: Lecture Notes on Games, Birzeit University, Palestine Fall Semester, 204 Artificial Intelligence Chapter 6 Games (adversarial search problems) Dr. Mustafa Jarrar Sina Institute, University

More information

Adversarial Search Aka Games

Adversarial Search Aka Games Adversarial Search Aka Games Chapter 5 Some material adopted from notes by Charles R. Dyer, U of Wisconsin-Madison Overview Game playing State of the art and resources Framework Game trees Minimax Alpha-beta

More information

Game playing. Chapter 5, Sections 1 6

Game playing. Chapter 5, Sections 1 6 Game playing Chapter 5, Sections 1 6 Artificial Intelligence, spring 2013, Peter Ljunglöf; based on AIMA Slides c Stuart Russel and Peter Norvig, 2004 Chapter 5, Sections 1 6 1 Outline Games Perfect play

More information

CS 188: Artificial Intelligence. Overview

CS 188: Artificial Intelligence. Overview CS 188: Artificial Intelligence Lecture 6 and 7: Search for Games Pieter Abbeel UC Berkeley Many slides adapted from Dan Klein 1 Overview Deterministic zero-sum games Minimax Limited depth and evaluation

More information

Analyzing Games: Solutions

Analyzing Games: Solutions Writing Proofs Misha Lavrov Analyzing Games: olutions Western PA ARML Practice March 13, 2016 Here are some key ideas that show up in these problems. You may gain some understanding of them by reading

More information

Game Tree Search 1/6/17

Game Tree Search 1/6/17 Game Tree Search /6/7 Frameworks for Decision-Making. Goal-directed planning Agents want to accomplish some goal. The agent will use search to devise a plan.. Utility maximization Agents ascribe a utility

More information

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

Announcements. Homework 1. Project 1. Due tonight at 11:59pm. Due Friday 2/8 at 4:00pm. Electronic HW1 Written HW1 Announcements Homework 1 Due tonight at 11:59pm Project 1 Electronic HW1 Written HW1 Due Friday 2/8 at 4:00pm CS 188: Artificial Intelligence Adversarial Search and Game Trees Instructors: Sergey Levine

More information

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

Today. Types of Game. Games and Search 1/18/2010. COMP210: Artificial Intelligence. Lecture 10. Game playing COMP10: Artificial Intelligence Lecture 10. Game playing Trevor Bench-Capon Room 15, Ashton Building Today We will look at how search can be applied to playing games Types of Games Perfect play minimax

More information

ARTIFICIAL INTELLIGENCE (CS 370D)

ARTIFICIAL INTELLIGENCE (CS 370D) Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) (CHAPTER-5) ADVERSARIAL SEARCH ADVERSARIAL SEARCH Optimal decisions Min algorithm α-β pruning Imperfect,

More information

Adversarial Search: Game Playing. Reading: Chapter

Adversarial Search: Game Playing. Reading: Chapter Adversarial Search: Game Playing Reading: Chapter 6.5-6.8 1 Games and AI Easy to represent, abstract, precise rules One of the first tasks undertaken by AI (since 1950) Better than humans in Othello and

More information

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

Local Search. Hill Climbing. Hill Climbing Diagram. Simulated Annealing. Simulated Annealing. Introduction to Artificial Intelligence Introduction to Artificial Intelligence V22.0472-001 Fall 2009 Lecture 6: Adversarial Search Local Search Queue-based algorithms keep fallback options (backtracking) Local search: improve what you have

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence CS482, CS682, MW 1 2:15, SEM 201, MS 227 Prerequisites: 302, 365 Instructor: Sushil Louis, sushil@cse.unr.edu, http://www.cse.unr.edu/~sushil Games and game trees Multi-agent systems

More information

Tangent: Boromean Rings. The Beer Can Game. Plan. A Take-Away Game. Mathematical Games I. Introduction to Impartial Combinatorial Games

Tangent: Boromean Rings. The Beer Can Game. Plan. A Take-Away Game. Mathematical Games I. Introduction to Impartial Combinatorial Games K. Sutner D. Sleator* Great Theoretical Ideas In Computer Science CS 15-251 Spring 2014 Lecture 110 Feb 4, 2014 Carnegie Mellon University Tangent: Boromean Rings Mathematical Games I Challenge for next

More information

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

CS440/ECE448 Lecture 9: Minimax Search. Slides by Svetlana Lazebnik 9/2016 Modified by Mark Hasegawa-Johnson 9/2017 CS440/ECE448 Lecture 9: Minimax Search Slides by Svetlana Lazebnik 9/2016 Modified by Mark Hasegawa-Johnson 9/2017 Why study games? Games are a traditional hallmark of intelligence Games are easy to formalize

More information

Game playing. Outline

Game playing. Outline Game playing Chapter 6, Sections 1 8 CS 480 Outline Perfect play Resource limits α β pruning Games of chance Games of imperfect information Games vs. search problems Unpredictable opponent solution is

More information

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

Game Tree Search. Generalizing Search Problems. Two-person Zero-Sum Games. Generalizing Search Problems. CSC384: Intro to Artificial Intelligence CSC384: Intro to Artificial Intelligence Game Tree Search Chapter 6.1, 6.2, 6.3, 6.6 cover some of the material we cover here. Section 6.6 has an interesting overview of State-of-the-Art game playing programs.

More information

HW4: The Game of Pig Due date: Tuesday, Mar 15 th at 9pm. Late turn-in deadline is Thursday, Mar 17th at 9pm.

HW4: The Game of Pig Due date: Tuesday, Mar 15 th at 9pm. Late turn-in deadline is Thursday, Mar 17th at 9pm. HW4: The Game of Pig Due date: Tuesday, Mar 15 th at 9pm. Late turn-in deadline is Thursday, Mar 17th at 9pm. 1. Background: Pig is a folk jeopardy dice game described by John Scarne in 1945, and was an

More information

16.410/413 Principles of Autonomy and Decision Making

16.410/413 Principles of Autonomy and Decision Making 16.10/13 Principles of Autonomy and Decision Making Lecture 2: Sequential Games Emilio Frazzoli Aeronautics and Astronautics Massachusetts Institute of Technology December 6, 2010 E. Frazzoli (MIT) L2:

More information

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

The game of Reversi was invented around 1880 by two. Englishmen, Lewis Waterman and John W. Mollett. It later became Reversi Meng Tran tranm@seas.upenn.edu Faculty Advisor: Dr. Barry Silverman Abstract: The game of Reversi was invented around 1880 by two Englishmen, Lewis Waterman and John W. Mollett. It later became

More information

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

Games CSE 473. Kasparov Vs. Deep Junior August 2, 2003 Match ends in a 3 / 3 tie! Games CSE 473 Kasparov Vs. Deep Junior August 2, 2003 Match ends in a 3 / 3 tie! Games in AI In AI, games usually refers to deteristic, turntaking, two-player, zero-sum games of perfect information Deteristic:

More information

CS 331: Artificial Intelligence Adversarial Search II. Outline

CS 331: Artificial Intelligence Adversarial Search II. Outline CS 331: Artificial Intelligence Adversarial Search II 1 Outline 1. Evaluation Functions 2. State-of-the-art game playing programs 3. 2 player zero-sum finite stochastic games of perfect information 2 1

More information

Game Playing AI. Dr. Baldassano Yu s Elite Education

Game Playing AI. Dr. Baldassano Yu s Elite Education Game Playing AI Dr. Baldassano chrisb@princeton.edu Yu s Elite Education Last 2 weeks recap: Graphs Graphs represent pairwise relationships Directed/undirected, weighted/unweights Common algorithms: Shortest

More information

CSC384: Introduction to Artificial Intelligence. Game Tree Search

CSC384: Introduction to Artificial Intelligence. Game Tree Search CSC384: Introduction to Artificial Intelligence Game Tree Search Chapter 5.1, 5.2, 5.3, 5.6 cover some of the material we cover here. Section 5.6 has an interesting overview of State-of-the-Art game playing

More information

CSE 3401 Assignment 4 Winter Date out: March 26. Date due: April 6, at 11:55 pm

CSE 3401 Assignment 4 Winter Date out: March 26. Date due: April 6, at 11:55 pm CSE 3401 Assignment 4 Winter 2013 Date out: March 26. Date due: April 6, at 11:55 pm The submitted assignment must be based on your individual work. Review the Academic Honesty Guidelines for more details.

More information

COMP219: Artificial Intelligence. Lecture 13: Game Playing

COMP219: Artificial Intelligence. Lecture 13: Game Playing CMP219: Artificial Intelligence Lecture 13: Game Playing 1 verview Last time Search with partial/no observations Belief states Incremental belief state search Determinism vs non-determinism Today We will

More information

Combined Games. Block, Alexander Huang, Boao. icamp Summer Research Program University of California, Irvine Irvine, CA

Combined Games. Block, Alexander Huang, Boao. icamp Summer Research Program University of California, Irvine Irvine, CA Combined Games Block, Alexander Huang, Boao icamp Summer Research Program University of California, Irvine Irvine, CA 92697 August 17, 2013 Abstract What happens when you play Chess and Tic-Tac-Toe at

More information

Ar#ficial)Intelligence!!

Ar#ficial)Intelligence!! Introduc*on! Ar#ficial)Intelligence!! Roman Barták Department of Theoretical Computer Science and Mathematical Logic So far we assumed a single-agent environment, but what if there are more agents and

More information

Artificial Intelligence. Minimax and alpha-beta pruning

Artificial Intelligence. Minimax and alpha-beta pruning Artificial Intelligence Minimax and alpha-beta pruning In which we examine the problems that arise when we try to plan ahead to get the best result in a world that includes a hostile agent (other agent

More information

Intro to Java Programming Project

Intro to Java Programming Project Intro to Java Programming Project In this project, your task is to create an agent (a game player) that can play Connect 4. Connect 4 is a popular board game, similar to an extended version of Tic-Tac-Toe.

More information

Game-playing AIs: Games and Adversarial Search I AIMA

Game-playing AIs: Games and Adversarial Search I AIMA Game-playing AIs: Games and Adversarial Search I AIMA 5.1-5.2 Games: Outline of Unit Part I: Games as Search Motivation Game-playing AI successes Game Trees Evaluation Functions Part II: Adversarial Search

More information

Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! Due (in dropbox) Tuesday, September 23, 9:34am

Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! Due (in dropbox) Tuesday, September 23, 9:34am Introduction to Artificial Intelligence CS 151 Programming Assignment 2 Mancala!! Due (in dropbox) Tuesday, September 23, 9:34am The purpose of this assignment is to program some of the search algorithms

More information