1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

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 <mcostalba@gmail.com>
This commit is contained in:
Joona Kiiski 2010-07-18 16:24:07 +03:00 committed by Marco Costalba
parent 6e06db93fd
commit 1322ab97c7

View file

@ -364,7 +364,6 @@ void SearchStack::init() {
currentMove = threatMove = bestMove = MOVE_NONE; currentMove = threatMove = bestMove = MOVE_NONE;
reduction = Depth(0); reduction = Depth(0);
eval = VALUE_NONE;
} }
// SearchStack::initKillers() initializes killers for a search stack entry // SearchStack::initKillers() initializes killers for a search stack entry
@ -771,8 +770,7 @@ namespace {
// Step 5. Evaluate the position statically // Step 5. Evaluate the position statically
// At root we do this only to get reference value for child nodes // At root we do this only to get reference value for child nodes
if (!isCheck) ss->eval = isCheck ? VALUE_NONE : evaluate(pos, ei);
ss->eval = evaluate(pos, ei);
// Step 6. Razoring (omitted at root) // Step 6. Razoring (omitted at root)
// Step 7. Static null move pruning (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 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); update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval);
} }
else
ss->eval = VALUE_NONE;
// Step 6. Razoring (is omitted in PV nodes) // Step 6. Razoring (is omitted in PV nodes)
if ( !PvNode if ( !PvNode
@ -1450,7 +1450,6 @@ namespace {
TM.incrementNodeCounter(pos.thread()); TM.incrementNodeCounter(pos.thread());
ss->bestMove = ss->currentMove = MOVE_NONE; ss->bestMove = ss->currentMove = MOVE_NONE;
ss->eval = VALUE_NONE;
// Check for an instant draw or maximum ply reached // Check for an instant draw or maximum ply reached
if (pos.is_draw() || ply >= PLY_MAX - 1) if (pos.is_draw() || ply >= PLY_MAX - 1)
@ -1473,6 +1472,7 @@ namespace {
if (isCheck) if (isCheck)
{ {
bestValue = futilityBase = -VALUE_INFINITE; bestValue = futilityBase = -VALUE_INFINITE;
ss->eval = VALUE_NONE;
deepChecks = enoughMaterial = false; deepChecks = enoughMaterial = false;
} }
else else
@ -2753,6 +2753,8 @@ namespace {
// Find a quick score for the move // Find a quick score for the move
init_ss_array(ss, PLY_MAX_PLUS_2); init_ss_array(ss, PLY_MAX_PLUS_2);
ss[0].eval = VALUE_NONE;
ss[0].currentMove = cur->move;
pos.do_move(cur->move, st); pos.do_move(cur->move, st);
moves[count].move = cur->move; moves[count].move = cur->move;
moves[count].score = -qsearch<PV>(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1); moves[count].score = -qsearch<PV>(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1);