// but if we are pondering or in infinite search, we shouldn't print the best
// move before we are told to do so.
if (!Signals.stop && (Limits.ponder || Limits.infinite))
- RootPos.this_thread()->wait_for_stop_or_ponderhit();
+ {
+ Signals.stopOnPonderhit = true;
+ RootPos.this_thread()->wait_for_stop();
+ }
// Best move could be MOVE_NONE when searching on a stalemate position
sync_cout << "bestmove " << move_to_uci(RootMoves[0].pv[0], RootPos.is_chess960())
continue;
}
- pvMove = PvNode ? moveCount == 1 : false;
+ pvMove = PvNode && moveCount == 1;
ss->currentMove = move;
if (!SpNode && !captureOrPromotion && playedMoveCount < 64)
movesSearched[playedMoveCount++] = move;
if (value > bestValue)
{
- bestValue = value;
- if (SpNode) sp->bestValue = value;
+ bestValue = SpNode ? sp->bestValue = value : value;
if (value > alpha)
{
- bestMove = move;
- if (SpNode) sp->bestMove = move;
+ bestMove = SpNode ? sp->bestMove = move : move;
- if (PvNode && value < beta)
- {
- alpha = value; // Update alpha here! Always alpha < beta
- if (SpNode) sp->alpha = value;
- }
+ if (PvNode && value < beta) // Update alpha! Always alpha < beta
+ alpha = SpNode ? sp->alpha = value : value;
else
{
assert(value >= beta); // Fail high
- if (SpNode) sp->cutoff = true;
+ if (SpNode)
+ sp->cutoff = true;
+
break;
}
}
&& !sp->slavesMask)
{
assert(!sp->master->is_searching);
- sp->master->wake_up();
+ sp->master->notify_one();
}
// After releasing the lock we cannot access anymore any SplitPoint