The Game of Chess
1. Objective
The objective of this assignment is to practice concepts related to inheritance,
overriding, polymorphism, and abstract classes, to program the basics of a chess
playing program. No, we
...
The Game of Chess
1. Objective
The objective of this assignment is to practice concepts related to inheritance,
overriding, polymorphism, and abstract classes, to program the basics of a chess
playing program. No, we are not implementing Deep Blue . We are just creating a toy
version that lets you set up pieces on the board, move them, and find possible moves
given a certain position.
Because we are simplifying so many rules, we'll call this game, Modified chESS
or MESS!
Description
Chess is played on an 8 X 8 board where the initial placement of pieces is as shown in
the following figure, taken from Wikipedia Note the indexing scheme. The white king is
on e1, and the black king is on e8. Familiarize yourself with the names of the pieces.
Each chess piece can move in a specific way. Details of the original rules are
provided here (Links to an external site.). However, we will follow a simplified version in
this assignment. Most importantly, we will ignore an important rule in chess: Moving any
piece in a way that puts your own king in check is illegal. Since we don't know
what check means, for us a move is legal if the piece we are moving has an empty
square to move to or can capture (replace) an opponent's piece (including their king,
although that's also illegal in real chess).
The king does not move at all. Nor can it castle (Links to an external site.).
The queen and knight can't move either.
A pawn in the initial position may move one or two squares vertically forward
to an empty square but cannot leap over any piece. Subsequently it can
move only one square vertically forward to an empty square. A pawn may
also capture (replace) an opponent's piece diagonally one square in front of
it. Pawns can never move backwards. These are the only moves; we will not
implement the En passant (Links to an external site.) rule and will also not
allow promotion (Links to an external site.) to another piece if the pawn
reaches the end of the column.
A rook can move any number of squares horizontally or vertically, forward or
backward, as long as it does not have to leap over other pieces. At the end of
the move, it can occupy a previously empty square or capture (replace) an
opponent's piece but it cannot replace another piece of the same player.
A bishop can move any number of squares diagonally in any direction as long
as it does not have to leap over other pieces. At the end of the move, it can
occupy a previously empty square or capture (replace) an opponent's piece
but it cannot replace another piece of the same player.
[Show More]