private boolean isPromotionMove(Square startSquare, Square endSquare) { boolean isPromotionMove = false; Piece piece = board.pieceOn(startSquare); if (piece != null && PieceType.PAWN.equals(piece.pieceType()) && endSquare.inLastRowForColor(piece.color())) { isPromotionMove = true; } return isPromotionMove; }
private void removeCapturedPiece(Move move) { Piece capturedPiece = null; if (MoveType.CAPTURE.equals(move.moveType())) { capturedPiece = ((CaptureMove) move).opposingPiece(); } else if (MoveType.EN_PASSANT.equals(move.moveType())) { capturedPiece = ((EnPassantMove) move).opposingPiece(); } else if (MoveType.PROMOTION.equals(move.moveType())) { capturedPiece = ((PromotionMove) move).opposingPiece(); } if (capturedPiece != null) { capturedPieces.get(capturedPiece.color()).remove(capturedPiece); } }