|
Class Chessboard
java.lang.Object
|
+----Chessboard
-
public class Chessboard
-
extends Object
-
Chessboard()
-
Default Constructor
-
CheckPiece(boolean,
int, int)
-
Check to see if the player's piece is at the start coordinate
-
Clear(int,
int, boolean)
-
Determines if a space is clear
-
DrawBoard(Graphics,
Evaluator)
-
Draws The Chessboard
-
EvaluateBoard(Evaluator,
boolean)
-
Evaluates the given board
-
MakeMove(boolean,
int, int, int, int, Evaluator)
-
Moves the pieces once after move has been validated
-
ValidateInput(int,
int)
-
ValidateMove(boolean,
int, int, int, int)
-
Determine if the move is valid
Chessboard
public Chessboard()
-
Default Constructor
MakeMove
public boolean MakeMove(boolean BeBlacksMove,
int X1,
int Y1,
int X2,
int Y2,
Evaluator applet)
-
Moves the pieces once after move has been validated
-
Parameters:
-
BeBlacksMove - true if it is black's move
-
X1 - the initial x-coordinate of the piece
-
Y1 - the initial y-coordinate of the piece
-
X2 - the final x-coordinate of the piece
-
Y2 - the final y-coordinate of the piece
-
applet - a copy of the Evaluator applet
-
Returns:
-
true if king is taken
CheckPiece
public boolean CheckPiece(boolean BeBlacksMove,
int X,
int Y)
-
Check to see if the player's piece is at the start coordinate
-
Parameters:
-
BeBlacksMove - true if it is Black's move
-
X - the x coordinate to check
-
Y - the y coordinate to check
-
Returns:
-
true if it is your piece
EvaluateBoard
public int EvaluateBoard(Evaluator applet,
boolean BeBlacksMove)
-
Evaluates the given board
-
Parameters:
-
applet - a copy of the Evaluator applet
-
BeBlacksMove - true if it is black's move
-
Returns:
-
returns the total score for the board for the player about to move
Clear
public boolean Clear(int X,
int Y,
boolean ClearMove)
-
Determines if a space is clear
-
Parameters:
-
X - x-coordinate of the space
-
Y - y-coordinate of the space
-
ClearMove - the current value of ClearMove from the caller
-
Returns:
-
true if space is clear
ValidateInput
public boolean ValidateInput(int x,
int y)
-
Parameters:
-
x - x-coordinate of mouse click
-
y - y-coordinate of mouse click
-
Returns:
-
true if mouse click was on chessboard
ValidateMove
public boolean ValidateMove(boolean BeBlacksMove,
int X1,
int Y1,
int X2,
int Y2)
-
Determine if the move is valid
-
Parameters:
-
BeBlacksMove - true if it is Black's move
-
X1 - the x-coordinate of the piece to move
-
Y1 - the y-coordinate of the piece to move
-
X2 - the x-coordinate of the space to move to
-
Y2 - the x-coordinate of the space to move to
-
Returns:
-
true if the space is clear
DrawBoard
public void DrawBoard(Graphics g,
Evaluator applet)
-
Draws The Chessboard
-
Parameters:
-
graphics - g a graphics object
-
applet - a copy of the Evaluator applet
|