MCPcopy Index your code
hub / github.com/coding-parrot/chess-engine / evaluation

Method evaluation

src/main/java/game/Board.java:675–687  ·  view source on GitHub ↗
(int availableMoves)

Source from the content-addressed store, hash-verified

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()

Callers 6

captureAndReturnCheckMethod · 0.95
checkMateMethod · 0.95
staleMateMethod · 0.95
checkMateIn1Method · 0.95
alphaBetaMethod · 0.95
minMaxMethod · 0.80

Calls 2

isDrawMethod · 0.95
heuristicMethod · 0.95

Tested by 4

captureAndReturnCheckMethod · 0.76
checkMateMethod · 0.76
staleMateMethod · 0.76
checkMateIn1Method · 0.76