The lab is done in pairs.
You will start with the program that we worked on in class today: Chess.java. Every group writes a method or methods to check if a given piece can move to a given square. Use the Chess rules for information about possible moves.
As a minimum requirement, don't take blocking into account. As a full requirement, eliminate squares that are blocked by other pieces. You may ignore pawn two-square move.
Your methods should be declared following this convention:
/**
The method takes a square on a chess board (denoted by coordinates
row and column) and coordinates of a bishop position bishopRow
and bishopColumn.
It returns true if the bishop can move to the given square from its
position in one move (assuming there are no other pieces on the board),
and false otherwise.
**/
public static boolean bishopPossibleMove(int row, int column, int bishopRow,
int bishopColumn) {
// fill in your code here
}
In addition to pawnPossibleMove
method you also
need pawnPossibleCapture
method. Also note that there
should be an extra parameter passed to the pawn methods which will
indicate if the pawn is black or white: a
boolean isWhitePawn
.
If you want to account for blocking, add another parameter to your methods: the chess board.
Test your method(s) thoroughly.
When done, copy your method to the wiki: https://wiki.umn.edu/UMMCSci2101Summer2011/ChessProblem
Check and test at least one of another group's methods. Methods will be assigned as they become avaialble.
The entire class will work together to develop a program that prints out all possible safe moves for white in this configuration. You can print out just the squares, not the pieces that can move there.
the lab is based on in-class activities and the code uploaded to the wiki.