|
Class King
java.lang.Object
|
+----Chesspiece
|
+----King
-
public class King
-
extends Chesspiece
-
King(Chessboard,
boolean, int, int)
-
Default constructor
-
HaveCastled()
-
Check and see if king has moved
-
IsCastle(int,
int, Chesspiece[][])
-
Determines if the move is a valid attempt at castling
-
Moved()
-
Tells the king he has castled or given up castling rights
-
TellMeWhereIAm(int,
int)
-
Tells the pieces its new location after moving
-
ValidMove(int,
int, boolean, Chesspiece[][])
-
Validates a given position
King
public King(Chessboard Board,
boolean BeBlack,
int Row,
int Col)
-
Default constructor
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
-
Overrides:
-
TellMeWhereIAm in
class Chesspiece
HaveCastled
public boolean HaveCastled()
-
Check and see if king has moved
-
Returns:
-
true if king has moved ( and thus, cannot castle )
-
Overrides:
-
HaveCastled in class Chesspiece
Moved
public void Moved()
-
Tells the king he has castled or given up castling rights
-
Overrides:
-
Moved in class Chesspiece
IsCastle
public boolean IsCastle(int X,
int Y,
Chesspiece Board[][])
-
Determines if the move is a valid attempt at castling
-
Parameters:
-
X - x-coordinate of target
-
Y - y-coordinate of target
-
Board - the current chessboard
-
Returns:
-
True if the move is a valid castle
-
Overrides:
-
IsCastle
in class Chesspiece
ValidMove
public boolean ValidMove(int X,
int Y,
boolean Taking,
Chesspiece Board[][])
-
Validates a given position
-
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
-
Overrides:
-
ValidMove
in class Chesspiece
|