X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=00fd2005ed7445008263db7f71c547c72a3ef997;hp=a642357e3c4904ea0ff5f6160325cd51d52b8b59;hb=e5f450cf0bfe5a34dd4ea51a5592a71be4514601;hpb=320fa1b2f082a7db67363e468e7e241d7cedcc64 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index a642357e..00fd2005 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -114,7 +114,7 @@ namespace { constexpr Value LazyThreshold1 = Value(1400); constexpr Value LazyThreshold2 = Value(1300); constexpr Value SpaceThreshold = Value(12222); - constexpr Value NNUEThreshold = Value(520); + constexpr Value NNUEThreshold = Value(575); // KingAttackWeights[PieceType] contains king attack weights by piece type constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 81, 52, 44, 10 }; @@ -927,9 +927,6 @@ make_v: // Side to move point of view v = (pos.side_to_move() == WHITE ? v : -v) + Tempo; - // Damp down the evaluation linearly when shuffling - v = v * (100 - pos.rule50_count()) / 100; - return v; } @@ -941,14 +938,15 @@ make_v: Value Eval::evaluate(const Position& pos) { - if (Eval::useNNUE) - { - Value v = eg_value(pos.psq_score()); - // Take NNUE eval only on balanced positions - if (abs(v) < NNUEThreshold) - return NNUE::evaluate(pos) + Tempo; - } - return Evaluation(pos).value(); + bool classical = !Eval::useNNUE + || abs(eg_value(pos.psq_score())) >= NNUEThreshold; + Value v = classical ? Evaluation(pos).value() + : NNUE::evaluate(pos) + Tempo; + + // Damp down the evaluation linearly when shuffling + v = v * (100 - pos.rule50_count()) / 100; + + return v; } /// trace() is like evaluate(), but instead of returning a value, it returns