From: Joona Kiiski Date: Sun, 18 Jul 2010 13:24:07 +0000 (+0300) Subject: Do not reset ss->eval in the beginning of the node X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=1322ab97c737fe761bd6ae8786f852851b8f019f Do not reset ss->eval in the beginning of the node This avoids problems with IID clearing ss->eval and eval not being available when we return Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index 0afa0a28..7249a113 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -364,7 +364,6 @@ void SearchStack::init() { currentMove = threatMove = bestMove = MOVE_NONE; reduction = Depth(0); - eval = VALUE_NONE; } // SearchStack::initKillers() initializes killers for a search stack entry @@ -771,8 +770,7 @@ namespace { // Step 5. Evaluate the position statically // At root we do this only to get reference value for child nodes - if (!isCheck) - ss->eval = evaluate(pos, ei); + ss->eval = isCheck ? VALUE_NONE : evaluate(pos, ei); // Step 6. Razoring (omitted at root) // Step 7. Static null move pruning (omitted at root) @@ -1097,6 +1095,8 @@ namespace { refinedValue = refine_eval(tte, ss->eval, ply); // Enhance accuracy with TT value if possible update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval); } + else + ss->eval = VALUE_NONE; // Step 6. Razoring (is omitted in PV nodes) if ( !PvNode @@ -1450,7 +1450,6 @@ namespace { TM.incrementNodeCounter(pos.thread()); ss->bestMove = ss->currentMove = MOVE_NONE; - ss->eval = VALUE_NONE; // Check for an instant draw or maximum ply reached if (pos.is_draw() || ply >= PLY_MAX - 1) @@ -1473,6 +1472,7 @@ namespace { if (isCheck) { bestValue = futilityBase = -VALUE_INFINITE; + ss->eval = VALUE_NONE; deepChecks = enoughMaterial = false; } else @@ -2753,6 +2753,8 @@ namespace { // Find a quick score for the move init_ss_array(ss, PLY_MAX_PLUS_2); + ss[0].eval = VALUE_NONE; + ss[0].currentMove = cur->move; pos.do_move(cur->move, st); moves[count].move = cur->move; moves[count].score = -qsearch(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1);