The size of the board in this game is the same 64 square locations as before. Each side of the board has 8 rows of spaces we can place a piece. A visualization of the board with a Pawn piece:
If you think about chess pieces, they do similar things but in different ways. That sounds like these chess pieces should be designed with inheritance in mind, so that we can have certain methods that are common to all in some classes, and then add or override methods as we need to solve specific problems in the movement of the piece.
Your program must design concrete classes for all six of the types of chess pieces: King, Queen, Rook, Knight, Bishop, & Pawn. The pieces will move the same way as they do in chess:
1. The king piece can move one single square in any direction:
2. The queen can move in any direction on a straight or diagonal path:
Structured Programming Using Procedural Languages Project #3 (Individual) INSS 225.101 Spring 2018 Page 3 of 5
3. The bishop can move in any direction diagonally, so long as it is not obstructed by another piece:
4. The rook piece can move forward, backward, left or right at any time.
5. The Knight piece can move forward, backward, left or right two squares and must then move one square in either perpendicular direction
6. Pawn chess pieces can only directly forward one square:
Other than those that, the pieces have similar actions and reactions as the Chip in Project 2.
1. The piece will start by being “placed” on one location on the board (like above).
a. When being placed on the board, the new piece will need to know:
i. The number of total squares in the board.
ii. What horizontal row the piece is sitting in.
iii. What vertical row the piece is sitting in.
iv. Note: To solve the movement for the Pawn. You will need to know what are the sides that pawns can move straight (i.e., the sides of the board where all the pieces line up to start).
2. A piece may not move off the board. If an attempt to move off the board occurs, the piece will move as far as it can and then stop at the board’s edge.
3. Each time the chip moves, a message will be display to the screen (i.e.; System.out). There are two types of messages that will be displayed; if the move worked or if it bumped into an edge.
a. When a move is successful, the message “Good Move” will be displayed to the user.
b. When a move is not successful, the message will tell the user what edge of the board they bumped into.
i. “Hit left edge”
ii. “Hit right edge”
iii. “Hit top edge”
iv. “Hit bottom edge”
c. In addition to being displayed to the screen, the same message will also be returned to the method’s caller (i.e., via a String object).
4. The piece will answer what row it is on for the horizonal or vertical direction when asked.
As you did in Project two, you are going to have to create a tester program to test out all the different algorithms you created in your classes. Again, I don’t need to see that code. I have my own tester and it runs through all the tests I need to grade your assignment.
Do not wait to start this assignment. This might seem simple on the surface, but there is a lot of conditional decisions to make it work as described. Spend time to map it out before doing to much coding of the process.
What to turn in:
1. A digital copy of your Java source code (submitted via Sakai as an attachment). For this first assignment, please submit the source code for the class you created. You can attach the file you created to Sakai. You also can place it in a zip file if you wish. Please do not submit your source code pasted in a Word document. Text files only (.java or .txt).