B551 Homework 2. Assigned: Sept. 15, 2011 Due: Sept. 29, 2011

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

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

mywbut.com Two agent games : alpha beta pruning

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

2 person perfect information

ARTIFICIAL INTELLIGENCE (CS 370D)

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

Adversarial Search Aka Games

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

Homework Assignment #2

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

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

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

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

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

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

Adversary Search. Ref: Chapter 5

CSCI1410 Fall 2018 Assignment 2: Adversarial Search

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

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

CSC 110 Lab 4 Algorithms using Functions. Names:

Game Playing AI Class 8 Ch , 5.4.1, 5.5

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

Adversarial Search (Game Playing)

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

Game Playing AI. Dr. Baldassano Yu s Elite Education

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

Computer Game Programming Board Games

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

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

Assignment 2 (Part 1 of 2), University of Toronto, CSC384 - Intro to AI, Winter

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

CS188 Spring 2010 Section 3: Game Trees

Games (adversarial search problems)

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

CS 331: Artificial Intelligence Adversarial Search II. Outline

COSC 117 Programming Project 2 Page 1 of 6

Game-Playing & Adversarial Search

CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2. Assigned: Monday, February 6 Due: Saturday, February 18

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

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

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

Assignment 2, University of Toronto, CSC384 - Intro to AI, Winter

CMPUT 396 Tic-Tac-Toe Game

Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning

CS188 Spring 2014 Section 3: Games

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

game tree complete all possible moves

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

Artificial Intelligence Adversarial Search

Adversarial Search: Game Playing. Reading: Chapter

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

Artificial Intelligence. Minimax and alpha-beta pruning

ADVERSARIAL SEARCH. Chapter 5

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

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

Tic-Tac-Toe and machine learning. David Holmstedt Davho G43

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

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

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

University of Amsterdam. Encyclopedia of AI project. Tic-Tac-Toe. Authors: Andreas van Cranenburgh Ricus Smid. Supervisor: Maarten van Someren

Section Marks Agents / 8. Search / 10. Games / 13. Logic / 15. Total / 46

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

Artificial Intelligence 1: game playing

CS188 Spring 2010 Section 3: Game Trees

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

Adversarial Search and Game Playing

Comp th February Due: 11:59pm, 25th February 2014

PROBLEMS & INVESTIGATIONS. Introducing Add to 15 & 15-Tac-Toe

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

CS 771 Artificial Intelligence. Adversarial Search

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

Game Playing State-of-the-Art

Adversarial Search 1

Tic-tac-toe. Lars-Henrik Eriksson. Functional Programming 1. Original presentation by Tjark Weber. Lars-Henrik Eriksson (UU) Tic-tac-toe 1 / 23

CS 5522: Artificial Intelligence II

Artificial Intelligence. Topic 5. Game playing

More Adversarial Search

Ar#ficial)Intelligence!!

CS 4700: Foundations of Artificial Intelligence

Adversarial search (game playing)

Artificial Intelligence

Game-playing AIs: Games and Adversarial Search I AIMA

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

A Quoridor-playing Agent

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

Game Tree Search 1/6/17

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

Game Playing. Chapter 8

Midterm Examination. CSCI 561: Artificial Intelligence

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

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

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

More on games (Ch )

Instability of Scoring Heuristic In games with value exchange, the heuristics are very bumpy Make smoothing assumptions search for "quiesence"

CS510 \ Lecture Ariel Stolerman

Programming Project 1: Pacman (Due )

Artificial Intelligence

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

CS 188: Artificial Intelligence Spring Announcements

Transcription:

B551 Homework 2 Assigned: Sept. 15, 2011 Due: Sept. 29, 2011 1 Directions The problems below will ask you to implement three strategies for a gameplaying agent for the Gobblet Gobblers game demonstrated in class. You will need to: Rename the players/oware/username.py file to your IU user ID. Program your strategies in the indicated functions in that file. A state evaluation function giving a minimax value for a game state A minimax search procedure An alpha-beta search procedure A search procedure to be used in a game-playing tournament pitting all students submissions against each other. Answer the written questions below. See README.txt for a complete description of the game framework and the role of the file you are modifying. 1.1 Submission Upload your [userid].py file and any auxiliary files (additional Python modules or data files you may have used to implement your strategies) to On- Course. Do not upload modified versions of any of the other provided Python files (in fact, don t modify them at all; when we grade the homework we will use the canonical versions and your changes will not be reflected). Type or write your answers to the written questions and hand them in, hard-copy, by the end of class on the due date. 1

2 The Game For this homework we are playing a two-player game called Gobblet Gobblers. It is a variant of tic-tac-toe (or noughts and crosses) with the addition of sized pieces and the ability to move pieces that are already on the board. Larger pieces can swallow and conceal smaller pieces, either the player s own or the opposing player s. The smaller pieces remain on the board, under the larger ones, and are revealed if the larger pieces are moved. When computing the three-in-a-row objective, only the largest piece in a square is considered. The game s complete rules are online and may be viewed at http://www.blueorangegames.com/instructions.php. As the game is capable of cycling (repeating states), we introduce a new rule for our implementation: If a repeated state occurs, the game is declared a draw between the two players. We also adopt the convention that the blue player always moves first and the orange second. 3 Programming 3.1 Setup 1. Download the file hw2.zip from OnCourse. The file contains a directory structure, with base class definitions for a game-playing framework in the files game.py, game controller.py, and game state.py. Game definitions for tic-tac-toe and Gobblet Gobblers are in tictactoe.py and gobblet.py. Some sample game players are defined in the files in the players directory. For more information about these files and their roles, see README.txt and the files documentation. You are principally interested in the username.py file in the players/gobblet subdirectory, which defines an incomplete Gobblet Gobblers minimax player. You will complete the definition of this player to allow it to play the game. 2. Rename players/gobblet/username.py so that the filename is your IU user ID (your email address). For instance, Mark s ID is mw54, so he would rename the file to mw54.py in the same directory. This is the file you will alter and upload to OnCourse. 3. You may run the program with this command from the Windows command line (assuming the Python executable is in your PATH): python game.py gobblet gobblet simple gobblet simple 2

Or, on any UNIX/Mac system s command line:./game.py gobblet gobblet simple gobblet simple The second and third arguments to the command specify the player modules (Python files) to use for the game; the first specifies the game definition we use. gobblet simple.py resides in the same directory as your Gobblet agent and defines a not-very-smart Gobblet player: It simply selects the first move from the list of successors generated from the current game state. You can also use gobblet human as one or both players to allow humans to play the game. See README.txt and the Python files documentation for more information on running the program, or execute:./game.py -h 3.2 Programming Problems 1. Evaluation function for the Gobblers game The evaluation function, evaluate(), in your GobbletPlayer class is incomplete. Given a game state, the function should return a numeric value indicating how favorable a game state is to the MIN and MAX agents. (A value greater than 0 indicates a state favorable to MAX; less than 0, favorable to MIN; exactly 0, a neutral state with no advantage for either player.) Implement the evaluation function to return such a numeric value. Notes: You may wish to consult the definition of the GobbletState class (the type of object you ll be evaluating) in gobblet.py. A popular evaluation system for tic-tac-toe boards is to compare the number of three-in-a-row positions that have not been blocked off by the opposing player (and are therefore available to the player under consideration). This system is implemented in the tictactoe adv.py player in the players/tictactoe directory, which you can feel free to use as a reference. However, as pieces can be moved in this game and larger pieces may contain smaller pieces belonging to the other player, the Gobblet Gobblers game is more fluid than the above evaluation suggests. It is strongly suggested to incorporate other features, taking into account available and concealed pieces, in your evaluation. 3

2. Minimax procedure The minimax function, minimax move(), in your GobbletPlayer class is incomplete. Given a game state, the procedure should execute a minimax search, use the evaluate() function as appropriate, and return a GobbletMove object representing the best move for the current player. (The current player is arbitrary, according to how the game is being played, and may be obtained with the provided state s get next player() function. You do not need to write a successor function for this assignment one is already provided in the definition of the GobbletState class, and you can obtain successors for any state object by calling its successors() function. However, when executing the search, the player may only execute a set number of expansions i.e., you may only call GobbletState.successors() a certain number of times per turn before it will stop returning moves. (We use this rather than time to limit players search depth in the tournament, as time is unreliable and depends on the machine s load among other factors.) You may obtain the available number of expansions for your current move by calling the provided state s expansions count() function. Obviously, you should stick to calling the provided successor function and not circumvent the limitation on expansions by writing a separate one of your own. In your minimax function, compute a horizon h and use it to limit the depth of your search so that you don t run out of expansions. Notes: Again, feel free to consult the Tic-Tac-Toe example player. However, be careful about your math when computing the search horizon the Tic-Tac-Toe example may not be correct! Optionally, you may want to look into the mirror() and rotations() functions in gobblet.py. 3. Alpha-beta procedure The alpha-beta function, alpha beta move(), in your GobbletPlayer class is incomplete. Given a game state, the procedure should execute a minimax search with alpha-beta pruning and return a GobbletMove object representing the best move for the current player. This function should do all the same things as minimax move(), but with alpha-beta pruning. 4

Notes: Again, you must compute a reasonable horizon h but the horizon may be different for alpha-beta than for a simple minimax search. 4. Tournament procedure The search function used during the multi-agent tournament, tournament move(), in your GobbletPlayer class is incomplete. Given a game state, the procedure should execute some search routine and return a GobbletMove object representing the best move for the current player. This function may simply call the minimax or alpha-beta search routines; or you may enhance it with advanced techniques such as singular extension, multiple extension, best-move databases, etc. Extra credit will be awarded for the agent that wins the tournament by winning the most games. We will also award extra credit for creative implementations of the tournament search. 3.3 Written Questions Answer the following written questions, typed or written, and hand them in in hard-copy format. 1. Explain how you devised your state evaluation function, and why you think it is a good measure of a state s favorability to the players. 2. Given a default limit on the number of expansions, M, what is the largest horizon value h such that your minimax routine is guaranteed to expand a complete tree to that depth (i.e., all branches of the tree would unquestionably go that deep before you ran out of expansions)? Why? 3. Perform some experiments to see what is the largest horizon you can set without encountering the default limit on expansions with your alpha-beta search. (Hint: You may need to use some temporary print statements for this part.) Report on your findings. 4. Play your alpha-beta player against your minimax player. What do you observe? 5