Assignment 2 1/4 Cmput 455 Assignment 2 CONTENTS Assignment Overview Setup Goals of the Assignment Public Test Cases Other GTP Commands Pre-submission Test and Submission Hints and Details - Read them All Marking New Oct 12: revised test cases More issues have been discovered and fixed. Please update your test cases. Thanks to all who pointed out problems! Download new a2_public_easy.gtp, a2_public_medium.gtp, a2_public_hard.gtp or download new assignment2.tgz which contains these updated versions. New Oct 6: new test cases a2_public_easy.gtp (more easy tests added, a bug fixed, and moved some test cases into medium or hard) These test cases will be used for your presubmission tests, and for our feedback. Please replace your old a2_public_easy.gtp file. a2_public_medium.gtp a2_public_hard.gtp If you want, you can also download the complete updated starter code assignment2.tgz . The only change is that the old a2_public_easy.gtp file was replaced by the three files above. Assignment Overview Due Oct 16, 11:55pm on eClass. Submit via eClass submission link on the main eClass course page. Late submission (with 20% deduction) Oct 18, 11:55pm. Submit via separate eClass link for late submissions. In this assignment, you develop a perfect endgame solver for the game of Ninuki. You also integrate your solver into a player based on our starter code. Your player will play randomly at first, but will play a perfect endgame as soon as it can solve the game. To review the game Ninuki, see Assignment 1. Setup 1. Review the Assignments page for general questions about assignments. 2. As in assignment 1, make sure you have Python 3, NumPy and GoGui 1.51 set up. You can review the procedures under Lecture 3 activities. 3. Oct 6: New test files Download assignment2.tgz and expand it. The directory assignment2 contains: Our starter code for assignment 2. This implements a very basic random Ninuki player. A file a2_public_easy.gtp, with basic test cases for your program. Also use this for your presubmission test. See details below. 4. Oct 6: New test files a2_public_easy.gtp, a2_public_medium.gtp and a2_public_hard.gtp - see above. 5. Assignment 2 preview slides 6. More hints and ideas for Assignment 2 7. For reference, download the Lecture 8 python codes which include solvers for TicTacToe.
Assignment 2 2/4 Goals of the Assignment Implement the following functionality by adding or modifying existing GTP commands: 1. Implement a GTP command timelimit seconds The argument seconds is an integer in the range 1 <= seconds <= 100. This command sets the maximum time to use for all following genmove or solve commands, until it is changed by another timelimit command. Before the first timelimit command is given, the default should be set to 1 second. The public test cases show examples. 2. Implement a new GTP command solve which attempts to compute the winner of the current position, assuming perfect play by both, within the current time limit. Format: solve Your GTP response should be in the format: = winner [move] In the response, winner is either b, w, draw, or unknown. Write unknown if your solver cannot solve the game within the current time limit. Solving always starts with the current player (toPlay) going first. If the winner is toPlay or if its a draw, then also write a move that you found that achieves this best possible result. Moves should be in lowercase, so write e.g. b5 not B5. If there are several best moves, then write any one of them. If the winner is the opponent or unknown, then do not write any move in your GTP response. See the examples in public test cases. 3. genmove color Here, the argument color is either 'b' or 'w'. A version of the genmove command is already implemented in the starter code. You should change its behavior as follows: 1. If the game is not over yet, the program should use the solver to try to play perfectly. The solver must respect the current time limit as described under timelimit above. Note that the time limit is per move, not for the whole game. 2. If the game is not solved within the timelimit, or if toPlay is losing, then the genmove command should just play a random move. Public Test Cases We have grouped our test cases into three categories. Revised Oct 6: Easy - our (not public) simple solver can do them within the time limit given. Published Oct 6: Medium - our simple solver is too slow, but our better solver can do them. Published Oct 6: Hard - even our better solver times out. These are still good test cases for you, for checking your handling of time limits, and your GTP response in these cases. But if you can solve some of them, good for you! Almost all the tests fail for the starter code, since it does not implement the new commands. Note that our given test cases only cover a small subset of possibilities. For full evaluation, we will use a more comprehensive set of tests. Other GTP Commands
Assignment 2 3/4 Many other GTP commands are already implemented in the starter code. Do not break their functionality, since we will test your program using those commands, such as:
boardsize, clear_board, name, version, play,...
You are free to add to the implementations of these commands if you need it, e.g. depending on your approach, you may need to do something extra in the play command. But do not break the existing functionality. These commands are used by our test scripts. In this assignment, for convenience we will use multiple calls to boardsize and clear_board within the same gtp file, so make sure this use case still works in your solution. Pre-submission Test and Submission Follow the same general steps as in assignment 1 to create your presubmission.log file on a lab machine, and to create your submission, but (of course) using your assignment2 directory, assignment2.tgz as file name, and a2_public_easy.gtp as test. Remember to include your new presubmission.log and readme.txt. Your file must be a valid tgz file named assignment2.tgz which can be uncompressed with tar xvfz assignment2.tgz Do not change the name or location of your Go0.pymain file. Leave name and location the same as in the starter code. Do not introduce extra levels of directories or different directory names. Keep the same simple structure as in the starter code. You may add extra python files within the same directory. Hints and Details - Read them All Your solve command must stay within the time limit. For some ideas of how to do that in Python 3, see Measuring Time. Whatever you do, test that it works on the standard lab machines. To ensure that your solver is working and keeping the time limits, we recommend that you test your player by playing a few test matches between the original random player, and your player which includes your solver, with a modest time limit per move. You can use the gogui-twogtp tool to run the matches. See the gogui-twogtp notes. We think that such tests will help you to develop the program. However, you do not submit any test results with the assignment. Please be considerate in your use of shared resources such as lab machines, especially close to the deadline. No special error handling code is required in this assignment. We will only test with valid moves and valid GTP commands which have valid arguments. For examples of how to write new GTP commands, see the go0and1 and go2 codes, especially files gtp_connection_go1.py and gtp_connection_go2.py and how they are used in the main run() function of those players. We will only test with alternating play, so any play commands will be for the color toPlay. Clearing the board resets toPlay to Black. By default, we assume that teams will stay the same as in assignment 1. If you change your team, email Abbas the new information one week before the assignment 2 deadline. Note that being honest and returning "unknown" when your solver does not solve a position will lead to higher marks than randomly guessing the outcome. If you want to improve the efficiency of your solver, there is a large number of different approaches you can take. Some are discussed in Lecture 10. We also have collected more hints and ideas for Assignment 2, but we will leave it up to you what kinds of improvements you try. In any case, make sure to retain correctness of your solver. You will lose marks if your program just guesses the result, or does not compute it correctly because of bugs. Extensive testing is the key.
Assignment 2 4/4 Marking There will again be 5 marks for this assignment. 1 mark for your file presubmission.log which shows the log of your correct test execution, and your readme.txt file (as in Assignment 1). 2 marks for passing our public test cases 2 marks for passing our private test cases Both test sets contain a mix of easy, medium and hard cases. The difficulty of these cases varies within the groups, and it depends on the success of the improvements you implement. You do not need to solve the hard test cases to get full marks, but your solver needs to behave correctly on those as well. We will also test your player. Code that does not run, or just hardcodes the public tests case by case, will receive a mark of 0. If your code needs fixes, you need to submit a revised version before the late submission deadline. Our TA will not attempt to fix your code under any circumstances. Use the discussion forum or consult the teaching team in case of questions. Last modified: Sep 26, 2023 by Martin M ller
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。