In this two-player game, each player has control of two chess knights on a chessboard (which can be of any size). On your turn, you must move one of your knights toward the upper-left corner of the board. In general, this means that four moves are available:
Of course, if a knight is near the top or left of the board, fewer moves will be possible, and a knight in the upper left 2x2 area cannot move at all. For this reason, the board can be considered to extend infinitely far down and to the right without the state space becoming infinitely large. In addition, a knight is not allowed to move to a square occupied by another knight (of either color). You lose the game if you are unable to make a move. As such, this game has no draws.
For this project, you will write code in Python that
determines optimal moves for this game (in the minimax sense).
Specifically, you must produce a file
reads in a game state from the command line (described below) including which
player is to move, and returns
the best possible next position after
that player's move who will win if both players play optimally.
You should print out either "WHITE WILL WIN" or "BLACK WILL WIN" depending on which player can win the game if each play optimally. An example of running your function is:
username$ bestmove.py BLACK 2 2 3 3 1 2 3 1
BLACK WILL WIN
The format for the command line arguments is:
WHITE/BLACK, which player will go first
Make sure not to print anything other than "BLACK/WHITE WILL WIN" in the final version you submit. (Presumably other print statements will be useful for you during debugging, but turn these off.)
You must also include a writeup (no more than one page) that describes your representation and how your code works. It must be clear enough for me to appropriately grade your code on efficiency and correctness.
You will submit your project using mycourses. You need to submit
writeup.txt, which is a
plain text file documenting your code.
Your code will be tested using Python 2.6.
Your project grade will be assigned as follows:
Q) Will the program be tested with bad data?
A) No, the program will only be tested with valid inputs.
Q) Will you please give me a set of test cases?
A) No. :)