Skip to content

Commit

Permalink
Make staticEval independent of the path
Browse files Browse the repository at this point in the history
current master can yield different staticEvals depending on the path used to reach the position. The reason for this is that the evaluation after a null move is always assumed to be different by 2 * Eval::Tempo, while this is not the case in the current lazy eval.

This patch restores the consistency on staticEval.

position fen 1k3b1q/pP2p1p1/P1K1P1Pp/7P/2B5/8/8/8 w - - 0 1
moves c4b3 h8g8 b3d5 g8h8 -> -2124
moves c4d5 null           -> -2084

Bench: 5368891
  • Loading branch information
vondele committed Dec 10, 2017
1 parent 196ae7c commit 8503b7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/evaluate.cpp
Expand Up @@ -849,7 +849,7 @@ namespace {
// Early exit if score is high
Value v = (mg_value(score) + eg_value(score)) / 2;
if (abs(v) > LazyThreshold)
return pos.side_to_move() == WHITE ? v : -v;
return (pos.side_to_move() == WHITE ? v : -v) + Eval::Tempo;

// Main evaluation begins here

Expand Down

0 comments on commit 8503b7a

Please sign in to comment.