// When playing with strength handicap enable MultiPV search that we will
// use behind-the-scenes to retrieve a set of possible moves.
if (skill.enabled())
- multiPV = std::max(multiPV, (size_t)4);
+ multiPV = std::max(multiPV, size_t(4));
multiPV = std::min(multiPV, rootMoves.size());
constexpr bool PvNode = nodeType != NonPV;
constexpr bool rootNode = nodeType == Root;
+ // Dive into quiescence search when the depth reaches zero
+ if (depth <= 0)
+ return qsearch<PvNode ? PV : NonPV>(pos, ss, alpha, beta);
+
// Check if we have an upcoming move that draws by repetition, or
// if the opponent had an alternative move earlier to this position.
if ( !rootNode
return alpha;
}
- // Dive into quiescence search when the depth reaches zero
- if (depth <= 0)
- return qsearch<PvNode ? PV : NonPV>(pos, ss, alpha, beta);
-
assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE);
assert(PvNode || (alpha == beta - 1));
assert(0 < depth && depth < MAX_PLY);
&& depth < 9
&& eval - futility_margin(depth, cutNode && !ss->ttHit, improving) - (ss-1)->statScore / 306 >= beta
&& eval >= beta
- && eval < 24923) // larger than VALUE_KNOWN_WIN, but smaller than TB wins
+ && eval < 24923) // smaller than TB wins
return eval;
// Step 9. Null move search with verification search (~35 Elo)
&& (tte->bound() & BOUND_LOWER)
&& tte->depth() >= depth - 4
&& ttValue >= probCutBeta
- && abs(ttValue) <= VALUE_KNOWN_WIN
- && abs(beta) <= VALUE_KNOWN_WIN)
+ && abs(ttValue) < VALUE_TB_WIN_IN_MAX_PLY
+ && abs(beta) < VALUE_TB_WIN_IN_MAX_PLY)
return probCutBeta;
const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
&& move == ttMove
&& !excludedMove // Avoid recursive singular search
/* && ttValue != VALUE_NONE Already implicit in the next condition */
- && abs(ttValue) < VALUE_KNOWN_WIN
+ && abs(ttValue) < VALUE_TB_WIN_IN_MAX_PLY
&& (tte->bound() & BOUND_LOWER)
&& tte->depth() >= depth - 3)
{
// Check if we have an upcoming move that draws by repetition, or
// if the opponent had an alternative move earlier to this position.
- if ( depth < 0
- && alpha < VALUE_DRAW
+ if ( alpha < VALUE_DRAW
&& pos.has_game_cycle(ss->ply))
{
alpha = value_draw(pos.this_thread());
// Futility pruning and moveCount pruning (~10 Elo)
if ( !givesCheck
&& to_sq(move) != prevSq
- && futilityBase > -VALUE_KNOWN_WIN
+ && futilityBase > VALUE_TB_LOSS_IN_MAX_PLY
&& type_of(move) != PROMOTION)
{
if (moveCount > 2)
if ( (Limits.use_time_management() && (elapsed > Time.maximum() || stopOnPonderhit))
|| (Limits.movetime && elapsed >= Limits.movetime)
- || (Limits.nodes && Threads.nodes_searched() >= (uint64_t)Limits.nodes))
+ || (Limits.nodes && Threads.nodes_searched() >= uint64_t(Limits.nodes)))
Threads.stop = true;
}
TimePoint elapsed = Time.elapsed() + 1;
const RootMoves& rootMoves = pos.this_thread()->rootMoves;
size_t pvIdx = pos.this_thread()->pvIdx;
- size_t multiPV = std::min((size_t)Options["MultiPV"], rootMoves.size());
+ size_t multiPV = std::min(size_t(Options["MultiPV"]), rootMoves.size());
uint64_t nodesSearched = Threads.nodes_searched();
uint64_t tbHits = Threads.tb_hits() + (TB::RootInTB ? rootMoves.size() : 0);