| Date Assigned: | Fri Sep-22 |
| Date Due: | Tue Sep-26 by start of P8 |
Note: This assignment is due Tuesday, assignment 4 revisions are due Monday. But you should definitely spend some solid time over the weekend working on this assignment, as it is more complex than any previous assignment. We can review some of your questions regarding this assignment on Monday in class.
Write a chess program which supports human-human play (so the program will not actually play, but only monitor play). Here are the features your program should have:
- You should query whether Player 1 or Player 2 is playing white
- Player 1 always goes first
- When querying for the next move, include the player number (as in: Player 1's move:).
- Moves should be entered in any reasonable fashion. So you could have them entered as a single string like a4-b5 (that's most preferred), but for now you could also just have them entered as four separate integers (0 4 1 5, this being the equivalent of a4-b5). These mean to move the piece at 0,4 to 1,5.
- You should verify that the move is legal for the piece involved, and remove any captured pieces from the board.
- Recall that knights may jump over pieces (so a wholly-surrounded knight can still move)
- All pieces besides knights may not jump over pieces
- A pawn may only capture a piece diagonally; further, this is the only time a pawn may move diagonally.
- If you know what it is, you may add "en passant" for extra credit
- If you know the relevant rules, you may also add "castling" for extra credit. Don't forget to make sure the castle is legal -- neither the king nor the rook may have moved yet, and you cannot castle to get out of check nor through check.
- While a player may not move into check, verifying this is left as extra credit.
- Before each move, you should display the "score", which for each player is computed by adding the point values for the various pieces -- use 1 for pawn, 3 for knight and bishop, 5 for rook, and 9 for queen. Do not add kings, because if you don't have one, you've lost anyhow.
- You do not need to verify checkmate (when the game is over) -- players can indicate that the game is over by entering in a move of 0000.
- On the off chance that this is underspecified, just state your assumptions.
- Remember: keep your code clean, very well-documented, and very easy to read and understand. Use proper variable names, avoid duplicated code fragments, and brush and floss at least twice daily. :-)