| 692 | } |
| 693 | |
| 694 | public boolean isDraw() { |
| 695 | if (isThreeFoldRepetition || fiftyMoveDraw) { |
| 696 | return true; |
| 697 | } |
| 698 | final List<Piece> currentPieces = playerPieces.get(playerToMove); |
| 699 | final List<Piece> opponentPieces = playerPieces.get(Color.opponent(playerToMove)); |
| 700 | final boolean playerCannotWin = insufficientMaterial(currentPieces); |
| 701 | final boolean opponentCannotWin = insufficientMaterial(opponentPieces); |
| 702 | return (playerCannotWin && opponentCannotWin); |
| 703 | } |
| 704 | |
| 705 | private boolean insufficientMaterial(List<Piece> opponentPieces) { |
| 706 | if (opponentPieces.size() == 1) { |