()
| 591 | } |
| 592 | |
| 593 | private void removeUnusedEnpassant() { |
| 594 | if (!moveList.isEmpty()) { |
| 595 | final Move previousMoveOfCurrentPlayer = moveList.get(moveList.size() - 1); |
| 596 | if (PieceType.PAWN.equals(previousMoveOfCurrentPlayer.piece.pieceType)) { |
| 597 | final Piece pawnLastMoved = previousMoveOfCurrentPlayer.piece; |
| 598 | if (Math.abs(previousMoveOfCurrentPlayer.target.row - pawnLastMoved.position.row) == 2) { |
| 599 | final int row = previousMoveOfCurrentPlayer.target.row; |
| 600 | for (int j = -1; j <= 1; j = j + 2) { |
| 601 | int col = previousMoveOfCurrentPlayer.target.col + j; |
| 602 | if (Utils.withinBoardLimits(row, col)) { |
| 603 | if (!isEmpty(row, col)) { |
| 604 | final Piece pawn = getPiece(row, col); |
| 605 | if (pawn.sameType(PieceType.PAWN) && pawn.color != previousMoveOfCurrentPlayer.piece.color) { |
| 606 | removeMoves(pawn.position); |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | } |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | private void removeMoves(Cell position) { |
| 617 | moves.remove(position); |
no test coverage detected