| 673 | //todo: idea: Should we compare a list of positions and choose the best? We do not evaluate positions in isolation, |
| 674 | // but rather rank them by comparing the top 20 positions possible |
| 675 | public double evaluation(int availableMoves) { |
| 676 | if (availableMoves == 0) { |
| 677 | if (inCheck) { |
| 678 | return Integer.MIN_VALUE; |
| 679 | } else { |
| 680 | return 0; |
| 681 | } |
| 682 | } |
| 683 | if (isDraw()) { |
| 684 | return 0; |
| 685 | } |
| 686 | return heuristic() + availableMoves / 100.0; |
| 687 | } |
| 688 | |
| 689 | private int heuristic() { |
| 690 | return playerPieces.get(playerToMove).stream().mapToInt(piece -> approxValue.get(piece.pieceType)).sum() |