## CSci 2101 Lab 3. Arrays.

### 30 points

The lab is done in pairs.

#### Part 1: writing methods for a chess board

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.

When done, copy your method to the wiki: https://wiki.umn.edu/UMMCSci2101Summer2011/ChessProblem

#### Part 2: Testing another group's method

Check and test at least one of another group's methods. Methods will be assigned as they become avaialble.

#### Part 3: putting it all together

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.

#### How to submit

the lab is based on in-class activities and the code uploaded to the wiki.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.