(Piece king, Cell coordinate)
| 802 | } |
| 803 | |
| 804 | private boolean discoveredCheck(Piece king, Cell coordinate) { |
| 805 | //knight and pawn can't give discoveries |
| 806 | final Line line = new Line(coordinate, king.position); |
| 807 | if (line.isStraight) { |
| 808 | for (int row = king.position.row + line.rowDiff, col = king.position.col + line.colDiff; Utils.withinBoardLimits(row, col); row = row + line.rowDiff, col = col + line.colDiff) { |
| 809 | if (!isEmpty(row, col)) { |
| 810 | final Piece piece = pieces.get(Cell.get(row, col)); |
| 811 | return piece.color != king.color && (piece.sameType(PieceType.QUEEN) || piece.sameType(line.minorPieceType)); |
| 812 | } |
| 813 | } |
| 814 | } |
| 815 | return false; |
| 816 | } |
| 817 | |
| 818 | @Override |
| 819 | public String toString() { |
no test coverage detected