Thank you , one last thing why does SF update PV in fail highhgm wrote:You do not collect the PV in the usual way in the root at the time a new PV move is found. Instead you do it at the end of the iteration, where you combine the best move with the PV left on the PV stack, which must have been put there by the latest PV daughter.
But it is not guaranteed that this PV daughter will also be the one responsible for the best move. In the face of search instability a NonPV pilot search can fail high, trigger a PV re-search, which then fails low after all. But it would produce a PV, overwriting the PV of the earlier best-move daughter.
A PV node that fails high can return an empty PV, if alpha was not increased before the cutoff occurs.
Code: Select all
if (value > alpha)
{
if (PvNode) // Update pv even in fail-high case
update_pv(ss->pv, move, (ss + 1)->pv);
if (PvNode && value < beta) // Update alpha here!
{
alpha = value;
bestMove = move;
}
else // Fail high
{
tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER,
ttDepth, move, ss->staticEval, TT.generation());
return value;
}
}
