X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fevaluate.cpp;h=728990680f6a1ac9e6fdd8df0e88a29ee327c7b3;hb=9b80897657bde99cfb6568d8bd3386c3999f22c4;hp=d4d8daee4da730c072ffa8321f39f414aa085288;hpb=ee53f8ed2f9418b55b05811da93ddf62f03c255f;p=stockfish diff --git a/src/evaluate.cpp b/src/evaluate.cpp index d4d8daee..72899068 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -58,8 +58,6 @@ namespace Eval { string currentEvalFileName = "None"; - static double to_cp(Value v) { return double(v) / UCI::NormalizeToPawnValue; } - /// NNUE::init() tries to load a NNUE network at startup time, or when the engine /// receives a UCI command "setoption name EvalFile value nn-[a-z0-9]{12}.nnue" /// The name of the NNUE network is always retrieved from the EvalFile option. @@ -145,7 +143,6 @@ Value Eval::evaluate(const Position& pos) { assert(!pos.checkers()); Value v; - Value psq = pos.psq_eg_stm(); int nnueComplexity; int npm = pos.non_pawn_material() / 64; @@ -155,8 +152,11 @@ Value Eval::evaluate(const Position& pos) { Value nnue = NNUE::evaluate(pos, true, &nnueComplexity); + int material = pos.non_pawn_material(stm) - pos.non_pawn_material(~stm) + + 126 * (pos.count(stm) - pos.count(~stm)); + // Blend optimism with nnue complexity and (semi)classical complexity - optimism += optimism * (nnueComplexity + abs(psq - nnue)) / 512; + optimism += optimism * (nnueComplexity + abs(material - nnue)) / 512; v = ( nnue * (915 + npm + 9 * pos.count()) + optimism * (154 + npm + pos.count())) / 1024; @@ -194,11 +194,11 @@ std::string Eval::trace(Position& pos) { Value v; v = NNUE::evaluate(pos, false); v = pos.side_to_move() == WHITE ? v : -v; - ss << "NNUE evaluation " << to_cp(v) << " (white side)\n"; + ss << "NNUE evaluation " << 0.01 * UCI::to_cp(v) << " (white side)\n"; v = evaluate(pos); v = pos.side_to_move() == WHITE ? v : -v; - ss << "Final evaluation " << to_cp(v) << " (white side)"; + ss << "Final evaluation " << 0.01 * UCI::to_cp(v) << " (white side)"; ss << " [with scaled NNUE, ...]"; ss << "\n";