CMPUT 657: Heuristic Search

Similar documents
Adversary Search. Ref: Chapter 5

2 person perfect information

ARTIFICIAL INTELLIGENCE (CS 370D)

mywbut.com Two agent games : alpha beta pruning

Pay attention to how flipping of pieces is determined with each move.

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

Artificial Intelligence Search III

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

ChesServe Test Plan. ChesServe CS 451 Allan Caffee Charles Conroy Kyle Golrick Christopher Gore David Kerkeslager

Documentation and Discussion

Adversarial Search Aka Games

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

CMPUT 396 Tic-Tac-Toe Game

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

CS 4700: Foundations of Artificial Intelligence

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

OCTAGON 5 IN 1 GAME SET

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

Adversarial Search and Game Playing

CS 4700: Artificial Intelligence

Adversarial Search (Game Playing)

Five-In-Row with Local Evaluation and Beam Search

ENEE 150: Intermediate Programming Concepts for Engineers Spring 2018 Handout #7. Project #1: Checkers, Due: Feb. 19th, 11:59p.m.

Monte Carlo tree search techniques in the game of Kriegspiel

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

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

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

Chess Algorithms Theory and Practice. Rune Djurhuus Chess Grandmaster / September 23, 2013

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro) 1

Chess Puzzle Mate in N-Moves Solver with Branch and Bound Algorithm

: Principles of Automated Reasoning and Decision Making Midterm

CSC 380 Final Presentation. Connect 4 David Alligood, Scott Swiger, Jo Van Voorhis

game tree complete all possible moves

Google DeepMind s AlphaGo vs. world Go champion Lee Sedol

Game Playing AI. Dr. Baldassano Yu s Elite Education

Game-Playing & Adversarial Search

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

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

CS 771 Artificial Intelligence. Adversarial Search

Homework Assignment #2

CS 221 Othello Project Professor Koller 1. Perversi

CS188 Spring 2010 Section 3: Game Trees

Game-playing AIs: Games and Adversarial Search I AIMA

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

A Quoridor-playing Agent

Adversarial Search. Chapter 5. Mausam (Based on slides of Stuart Russell, Andrew Parks, Henry Kautz, Linda Shapiro, Diane Cook) 1

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

Homework Assignment #1

Games (adversarial search problems)

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

Bootstrapping from Game Tree Search

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger. Project #3: Checkers

Artificial Intelligence Adversarial Search

More Adversarial Search

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

CS188 Spring 2010 Section 3: Game Trees

Adversarial Search: Game Playing. Reading: Chapter

Handling Search Inconsistencies in MTD(f)

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:

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

CS221 Othello Project Report. Lap Fung the Tortoise

CS188: Artificial Intelligence, Fall 2011 Written 2: Games and MDP s

COMP219: Artificial Intelligence. Lecture 13: Game Playing

CS61B Lecture #22. Today: Backtracking searches, game trees (DSIJ, Section 6.5) Last modified: Mon Oct 17 20:55: CS61B: Lecture #22 1

Senior Math Circles February 10, 2010 Game Theory II

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

Artificial Intelligence Lecture 3

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

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

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

Computing Science (CMPUT) 496

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

Leaf-Value Tables for Pruning Non-Zero-Sum Games

SEARCHING is both a method of solving problems and

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

Experiments on Alternatives to Minimax

2 Textual Input Language. 1.1 Notation. Project #2 2

Final Project: Reversi

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

Intuition Mini-Max 2

Spring 06 Assignment 2: Constraint Satisfaction Problems

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

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

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

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

ADVERSARIAL SEARCH. Chapter 5

Computer Game Programming Board Games

Gradual Abstract Proof Search

Adversarial Search 1

a b c d e f g h 1 a b c d e f g h C A B B A C C X X C C X X C C A B B A C Diagram 1-2 Square names

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game.

DELUXE 3 IN 1 GAME SET

Problem 1. (15 points) Consider the so-called Cryptarithmetic problem shown below.

3. Bishops b. The main objective of this lesson is to teach the rules of movement for the bishops.

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

Game Playing for a Variant of Mancala Board Game (Pallanguzhi)

LEARN TO PLAY CHESS CONTENTS 1 INTRODUCTION. Terry Marris December 2004

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

Presentation Overview. Bootstrapping from Game Tree Search. Game Tree Search. Heuristic Evaluation Function

Transcription:

CMPUT 657: Heuristic Search Assignment 1: Two-player Search Summary You are to write a program to play the game of Lose Checkers. There are two goals for this assignment. First, you want to build the smallest search trees possible. Second, you want to win the CMPUT 657 Game-Programming Championship (win the coveted championship trophy --- and defend our honor against the Icelandic game-programming champion). Both parts will contribute to your final mark for this assignment. You want the program to build small search trees, but also to run as fast as possible. Both issues are very important, because in the championship each program will be given a fixed amount of time per move. The smaller the search trees you build and the faster your program runs, the deeper your program will be able to search and, presumably, the stronger it will play. Lose Checkers Lose Checkers is played on an nxn board. Your program should be general enough to handle the 6x6, 8x8 and 10x10 cases. The game is played on a checkerboard, where only the white squares are used. A square can be one of empty, contain a black checker, black king, white checker or white king. The figure below shows the starting position for an 8x8 board. Note that the columns are labeled a to h, and the rows 1 to 8. For the 6x6 board, there are 6 pieces aside, while for the 10x10 board there are 20 aside. 8 7 6 5 4 3 2 1 a b c d e f g h The rules are simple: Black moves first; checkers move one square diagonally forward; kings move one square diagonally forward or backward; when a checker reaches the end of the board it is promoted to a king; checkers and kings can capture; the first person to run out of moves wins. Checkers can move only forward, diagonally, one square at a time to an unoccupied square. Squares are specified using algebraic notation, by giving the coordinates of the

column, a to h, and row, 1 to 8. Assuming Black starts at the top of the board, a Black checker on f6 can move to either e5 or g5. When a checker moves to the last rank of the board (squares a1, c1, e1, and g1 for Black; b8, d8, f8, and h8 for White), it is promoted to a king (usually shown in diagrams as two checkers on a square). Kings are allowed to move one square diagonally forward or backward to an unoccupied square. Checkers and kings capture men by jumping over them. If the square to which a piece could otherwise move is occupied by an opposing piece, and the next square in that direction is vacant, then a capture is allowed. The piece jumps over the opposing man and removes it, landing on the vacant square beyond it. If in the resulting position the same piece can make another capture, you are required to continue jumping. Thus checkers can only capture in the forward direction and kings can capture in any direction. If you have a capture move you must play it. If you have a choice of captures any one will do. The promotion of a checker to a king ends a move; a promotion cannot happen in the middle of a jump sequence. The goal of the game is to lose all your pieces! The game is over when: 1. the player to move has no legal moves (winning condition), or 2. a position has been repeated 3 times (the game is drawn). Part 1 This component tests the efficiency of your search algorithm. Use alpha-beta search (your choice of variant) with iterative deepening. At interior nodes, you will likely want to do some move ordering. Use a transposition table with a maximum of 256K entries. The evaluation function consists solely of the material difference (i.e. if player White has 10 pieces and player Black has 8, then the material difference is +2 in Black s favour less pieces is better than more). Part 2 This component tests the strength of your program. Anything goes. You can add search extensions or reductions to your algorithm, or any other search enhancement that you choose. You can modify the evaluation function in any way (note that you will want to consider doing this; material by itself may not be a good evaluation function). Do anything you can to improve your program's performance. Interface For Part 1, your program should support the following text commands: Setting up a position: i n Initialize the game to use an nxn board (n = 6, 8, or 10). B Black is to move. W White is to move. s Setup a new position. The position is given by specifying the contents of the board from left-to-right and top-to-bottom. The setup uses e for empty, b for a black player s checker, B: for a black player s king, w for a white player s checker and W for a white player s king. For example, the setup commands for the initial position of the 6x6 board would be as follows: s

bbb bbb eee eee www www B Playing moves: mx1y2 mx1.y2 Move from square x1 to y2 (a piece duplication or a jump, depending on where y2 is in relation to x1). A move like ma1b2 results in the piece on a1 moving to the empty square b2, while ma1b3 would be a jump, removing the opponent piece on b2. Note that a move could consist of several jumps each location that the capturing piece lands on has to be specified. In the following example, it is White to move and lose. White has only one legal move f8g7, Black must capture d8f6, White must capture g7e5c7a5c3e1g3, Black plays the winning move e3f2, White must capture g3e1, and since Black has no more legal moves, Black wins. r Retract (undo) the last move played. Search control: d n Set the search depth to "n". t n Search for "n" seconds of real time. When the time expires, stop the search. Note that both "t" and "d" can be set. Whenever one of the conditions is true, the search stops and the best move is played. g Begin searching. 1 Enable subsequent searches to use the Part 1 settings (fixed-depth, simple evaluation function). 2 Enable subsequent searches to use the Part 2 settings (anything goes). Execution control: q Quit from your program. Cntl-C Interrupt the search and stop it. Play the best move returned by the search.

In addition, you will want to implement your own set of user interface commands to assist in your debugging! For Part 2, the CMPUT 657 Lose Checkers Championship will be played using the Generic Games Server (GGS). You will get more information on connecting to the server later on in the course. Output After a search is complete, your program should display the best move, the best score, and the principal variation. It should play that move and then display the resulting new position. The following statistics should be printed after every search: Tree size: The number of interior and leaf/terminal nodes searched. Time: The number of seconds that the search took. Search depth: For each search depth (in an iterative deepening search), the number of leaf nodes examined in the search. Trans. table: The number of TT queries, the number of times the position was found in the TT, and the number of times that the TT entry gave a cutoff. CutBF: The average number of successors considered at a node where a cut-off occurs. Count only nodes where at least one move is searched (i.e., not just a transposition) and the value of the node is >= β. Plan Of Attack I recommend the following methodology for doing this assignment: 1. Build a program that supports setting up positions and playing legal moves. You should be able to setup a position, generate legal moves, play and retract moves, and end a game. 2. Add alpha-beta nothing fancy with the material-only evaluation function. Use shallow search depths to verify that alpha-beta is working correctly. Add assertions to your code so that if an error occurs, you catch it at the earliest possible time. 3. Add transposition tables. If you initially restrict a TT lookup to be valid only if the table depth exactly matches the depth that you need, then the TT will not change the result of a fixed-depth alpha-beta search. It should, however, reduce the number of nodes searched. Verify that this is working correctly! 4. Add in iterative deepening and move ordering. If you do this right, it should not change the final result of the search but, again, it should reduce the number of nodes searched. 5. Only when you are sure all the above is 100% working should you move on to more search enhancements and a better evaluation function. Assignment Submission 1. By e-mail, send Akihiro Kishimoto (kishi@cs) the code for your program and a Makefile. All programs should compile and run without difficulty on a Linux box.

2. On paper, hand in a short document describing your Part 1 program. Skip the basics (do not explain how alpha-beta works). I want to know how you augmented alpha-beta to reduce the size of the search tree. Justify your search enhancements by providing some experimental data for fixed-depth search trees. This document must be no longer than five pages. 3. On paper, hand in a short document describing the enhancements made in Part 2. Describe how you changed the search and/or evaluation function and why you think this makes a difference in the program's performance. This document must be no longer than three pages. Good luck!