|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--Board
This is the board object that will hold references to pieces in the arrangement they are found on the chess board. It is implemented using an array of ChessPiece references. It also has a copy() method that is used to make copies of it for the tree used in deciding how to move.
| Field Summary | |
protected ChessPiece[][] |
board
This is the array of ChessPieces. |
| Constructor Summary | |
Board()
Builds a new board setup to start a new game of chess. |
|
Board(Board b)
Builds a new board based on the given board. |
|
| Method Summary | |
Board |
copy()
Returns a field for field copy of this object. |
int |
evaluate()
Returns the current material value of the board. |
ChessPiece |
getPiece(int row,
int col)
Returns the piece at the specified location. |
void |
movePiece(Move theMove)
Makes a move according to the specified Move object, taking pieces if needed (by simply overwriting their spot in the array), leaving a null reference behind where the piece was originally located. |
protected void |
setPiece(int row,
int col,
ChessPiece piece)
Used to add pieces to the board. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected ChessPiece[][] board
| Constructor Detail |
public Board()
public Board(Board b)
| Method Detail |
public ChessPiece getPiece(int row,
int col)
protected void setPiece(int row,
int col,
ChessPiece piece)
public void movePiece(Move theMove)
public int evaluate()
public Board copy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||