This avoids problems with IID clearing ss->eval and
eval not being available when we return
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
currentMove = threatMove = bestMove = MOVE_NONE;
reduction = Depth(0);
currentMove = threatMove = bestMove = MOVE_NONE;
reduction = Depth(0);
}
// SearchStack::initKillers() initializes killers for a search stack entry
}
// SearchStack::initKillers() initializes killers for a search stack entry
// Step 5. Evaluate the position statically
// At root we do this only to get reference value for child nodes
// 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)
// Step 6. Razoring (omitted at root)
// Step 7. Static null move pruning (omitted at root)
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);
}
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
// Step 6. Razoring (is omitted in PV nodes)
if ( !PvNode
TM.incrementNodeCounter(pos.thread());
ss->bestMove = ss->currentMove = MOVE_NONE;
TM.incrementNodeCounter(pos.thread());
ss->bestMove = ss->currentMove = MOVE_NONE;
// Check for an instant draw or maximum ply reached
if (pos.is_draw() || ply >= PLY_MAX - 1)
// Check for an instant draw or maximum ply reached
if (pos.is_draw() || ply >= PLY_MAX - 1)
if (isCheck)
{
bestValue = futilityBase = -VALUE_INFINITE;
if (isCheck)
{
bestValue = futilityBase = -VALUE_INFINITE;
deepChecks = enoughMaterial = false;
}
else
deepChecks = enoughMaterial = false;
}
else
// Find a quick score for the move
init_ss_array(ss, PLY_MAX_PLUS_2);
// 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<PV>(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1);
pos.do_move(cur->move, st);
moves[count].move = cur->move;
moves[count].score = -qsearch<PV>(pos, ss+1, -VALUE_INFINITE, VALUE_INFINITE, Depth(0), 1);