evaluatePosition function
int
evaluatePosition(
- Chess c,
- Color player,
- NNUE nnue
)
Implementation
int evaluatePosition(Chess c, Color player, NNUE nnue) {
if (c.game_over) {
if (c.in_draw) {
return 0;
} else {
return c.turn == player ? -9999 : 9999;
}
}
List<int> pieceSquareInput = [];
for (var i = Chess.SQUARES_A8; i <= Chess.SQUARES_H1; i++) {
if ((i & 0x88) != 0) {
i += 7;
continue;
}
final piece = c.board[i];
if (piece != null) {
pieceSquareInput.add(i * 10 + piece.type.shift);
}
}
return nnue.evaluate(pieceSquareInput);
}