7 - - - - - - - - 6 - - - - - - - - 5 - - - - - - - - 4 - - - - - - - - 3 - - - - - - - - 2 - - - - - - - - 1 P0 P1 P2 P3 P4 P5 P6 P7 0 R0 K0 B0 Q K B1 K1 R1 0 1 2 3 4 5 6 7
For this assignment, you are going to implement a very relaxed version of a game of chess. There is no requirement for graphical component, so the main complexity is setting up your classes so that you can display a chess board, and then have pieces move on that chess board. If you are unfamiliar with the game of chess, or need a refresher on the movement rules, there is a good primer here.
You are required to have several classes for this assignment. You will, at the very least, need a class that represents the game board, which facilitates writing the board to the terminal. You will also need a class for each type of piece that makes up a chess game. Those pieces are:
In a full game of chess, there is a lot of complexity. We are going to remove basically all of it for the purposes of this program. You are only required to represent the basic movement of the pieces. So, for example, a pawn in your program is only permitted to move forward, and only one square at a time.
Each piece should have a way (given where it is expected to move to) to determine whether a move is valid or not. For a start, a new location is valid only if the new location is not occupied, and the location is reachable following the typical chess movement rules for that piece. You should make sure you can move the pieces correctly if they are the only piece on the board. Then you add additional pieces, to test your movement.
Once you have the basics of moving pieces around, then you can focus on getting the user to be able to control the pieces at runtime. You will need a menu loop, which will prompt the user for input twice. The user will first enter in the coordinate of the piece they want to move, and then the coordinate they want to move to.
You should spend some of time determining what attributes each of these classes require. You may be able to add additional classes that aid in the representation of the pieces and the board itself.
You are required to submit at least three test cases for this program. Each test case should be written in a test_chess_#.py file. Each of your test cases will involve moving a different chess piece. For each test case, you are required to show:
Remember, these files do not need to run at the time of submission. They should demonstrate that you have put forward the effort to understand what the assignment has tasked you to do, and how your classes are going to be structured.
You are required to submit a tar file to http://inquire.roanoke.edu/. On inquire, there is a link for Assignment 3. You can create a tar file by issuing the following commands:
cd ~/cs170/assignments tar czvf assignment3.tgz assignment3/