Class Chesspiece 

java.lang.Object
   |
   +----Chesspiece

public class Chesspiece 
extends Object 

Constructor Index 

o Chesspiece() 
Default constructor 
o Chesspiece(Chessboard) 
Constructor -- initializes the current game 

Method Index 

o CheckTaking(int, int, boolean, Chesspiece[][]) 
Determines if a piece is taking another piece 
o GetColor() 
Gets the color of the piece 
o GetName() 
Gets the name of the piece 
o HaveCastled() 
Check and see if king has moved Overridden in King.java 
o HaveMoved() 
Check and see if rook has moved Overridden in Castle.java 
o IsCastle(int, int, Chesspiece[][]) 
Determines if the move is a valid attempt at castling Overridden in King.java 
o Moved() 
Tells the king he has castled or given up castling rights Overridden in King.java 
o MoveScore(Chesspiece[][]) 
Scores the possible moves 
o SetIdentity(boolean, char, int, int) 
Sets the name and color of the piece 
o SetNotFirst() 
Sets the FirstMove flag for pawn to false after it makes its first move Overridden in Pawn.jave 
o TellMeWhereIAm(int, int) 
Tells the pieces its new location after moving 
o ValidMove(int, int, boolean, Chesspiece[][]) 
Validates a given position Must be overridden in each piece 

Constructors 

o Chesspiece 
 public Chesspiece()
Default constructor 
o Chesspiece 
 public Chesspiece(Chessboard Board)
Constructor -- initializes the current game 
Parameters: 
Board - a chessboard 

Methods 

o HaveCastled 
 public boolean HaveCastled()
Check and see if king has moved Overridden in King.java 
Returns: 
true if king has moved ( and thus, cannot castle ) 
o SetNotFirst 
 public void SetNotFirst()
Sets the FirstMove flag for pawn to false after it makes its first move Overridden in Pawn.jave 
o HaveMoved 
 public boolean HaveMoved()
Check and see if rook has moved Overridden in Castle.java 
Returns: 
true if rook has moved yet ( used for castling ) 
o IsCastle 
 public boolean IsCastle(int X2,
                         int Y2,
                         Chesspiece Chessboard[][])
Determines if the move is a valid attempt at castling Overridden in King.java 
Parameters: 
X - x-coordinate of target 
Y - y-coordinate of target 
Board - the current chessboard 
Returns: 
true if the move is a valid castle 
o Moved 
 public void Moved()
Tells the king he has castled or given up castling rights Overridden in King.java 
o SetIdentity 
 protected void SetIdentity(boolean BeBlack,
                            char ChPieceName,
                            int Row,
                            int Col)
Sets the name and color of the piece 
Parameters: 
BeBlack - true if the piece is Black 
ChPieceName - the name of the piece 
Row - the row ( rank ) coordinate 
Col - the column ( file ) coordinate 
o TellMeWhereIAm 
 public void TellMeWhereIAm(int Col,
                            int Row)
Tells the pieces its new location after moving 
Parameters: 
Row - is row coordinate 
Col - is column coordinate 
Returns: 
Piece has a name and color 
o GetName 
 public char GetName()
Gets the name of the piece 
Returns: 
character denoting the name of the piece 
o GetColor 
 public boolean GetColor()
Gets the color of the piece 
Returns: 
true if the piece is black 
o ValidMove 
 public boolean ValidMove(int X2,
                          int Y2,
                          boolean BeBlack,
                          Chesspiece Board[][])
Validates a given position Must be overridden in each piece 
Parameters: 
X - x-coordinate of move 
Y - y-coordinate of move 
Taking - true if we are capturing opponent's piece 
Board - the chessboard currently in play 
Returns: 
true if move is valid 
o MoveScore 
 public int MoveScore(Chesspiece Board[][])
Scores the possible moves 
Parameters: 
Board - the current chessboard 
Returns: 
a score denoting the number of spaces the piece controls. 
o CheckTaking 
 public boolean CheckTaking(int X,
                            int Y,
                            boolean BeBlack,
                            Chesspiece Board[][])
Determines if a piece is taking another piece 
Parameters: 
X - x-coordinate of destination 
Y - y-coordinate of destination 
BeBlack - true if the player is black 
Board - the current chessboard 
Returns: 
true if there is an opponent's piece at the target