From 211ebc5c7abda34efce3a9d8a9382ce94a7cdb76 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ste=CC=81phane=20Nicolet?= Date: Fri, 9 Feb 2018 01:10:27 +0100 Subject: [PATCH] Fix bug for 'eval' command in terminal The 'eval' debugging command in Terminal did not initialize the Eval::Contempt variable, leading to random output during debugging sessions (normal search was unaffected by the bug). Example of session where the two 'eval' commands should give the same output, but did not: ./stockfish position startpos d eval go depth 20 d eval The bug is fixed by initializing Eval::Contempt to SCORE_ZERO in Eval::trace No functional change. --- src/evaluate.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 60eee7a2..c69f675d 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -923,7 +923,10 @@ std::string Eval::trace(const Position& pos) { std::memset(scores, 0, sizeof(scores)); - Value v = Evaluation(pos).value() + Eval::Tempo; + Eval::Contempt = SCORE_ZERO; + + Value v = Eval::Tempo + Evaluation(pos).value(); + v = pos.side_to_move() == WHITE ? v : -v; // White's point of view std::stringstream ss; -- 2.39.2