Beispiel #1
0
 /**
  * Gets all valid piece moves for the bishop
  *
  * @param chessPiece piece to get moves for
  * @param opponentsChessPieces all opponents chess pieces
  * @param chessBoard the current chess board
  * @param lastMove the last move performed
  * @return a list of valid chess moves for this piece
  */
 @Override
 public List<ChessMove> getValidPieceMoves(
     Piece chessPiece,
     List<Piece> opponentsChessPieces,
     ChessBoard chessBoard,
     ChessMove lastMove) {
   List<ChessMove> validBishopMoves = new ArrayList<ChessMove>();
   byte[][] board = chessBoard.getBoard();
   PiecePosition piecePosition = chessPiece.getPosition();
   getValidBishopMovesForVerticalPath(1, 1, validBishopMoves, board, chessPiece, piecePosition);
   getValidBishopMovesForVerticalPath(1, -1, validBishopMoves, board, chessPiece, piecePosition);
   getValidBishopMovesForVerticalPath(-1, 1, validBishopMoves, board, chessPiece, piecePosition);
   getValidBishopMovesForVerticalPath(-1, -1, validBishopMoves, board, chessPiece, piecePosition);
   return validBishopMoves;
 }
Beispiel #2
0
 public boolean executeAction(ChessBoard board) throws CaptureException {
   return board.capture(this);
 }