public boolean move(int x, int y, int destX, int destY){ // TODO write this method return true; /** * This method takes as input the coordinates of the piece to move and of the destination to move to. * * It returns true if the move is valid
public boolean move(int x, int y, int destX, int destY){
// TODO write this method
return true;
/**
* This method takes as input the coordinates of the piece to move and of the destination to move to.
*
* It returns true if the move is valid and false otherwise.
*
* Conditions for a valid move are determined in canMove()
*
* Upon a successful move, this method also:
* - updates the board to reflect the move
* - tracks the move in game history
* - also tracks in history if the move was:
* - a capture
* - result in check EDIT: for either side
* - EDIT: also if it results in a win / king capture
* - updates the current player's turn
*
* x The x coordinate of the piece to move
* y The y coordinate of the piece to move
* destX The x coordinate of the destination to move to
* destY The y coordinate of the destination to move to
*/
Trending now
This is a popular solution!
Step by step
Solved in 4 steps