mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-23 18:46:59 +08:00
Merge branch 'master' into sf-nnue-nodchip
This commit is contained in:
@@ -525,7 +525,7 @@ void Thread::search() {
|
||||
double totalTime = rootMoves.size() == 1 ? 0 :
|
||||
Time.optimum() * fallingEval * reduction * bestMoveInstability;
|
||||
|
||||
// Stop the search if we have exceeded the totalTime, at least 1ms search.
|
||||
// Stop the search if we have exceeded the totalTime, at least 1ms search
|
||||
if (Time.elapsed() > totalTime)
|
||||
{
|
||||
// If we are allowed to ponder do not stop the search now but
|
||||
@@ -627,7 +627,7 @@ namespace {
|
||||
|| pos.is_draw(ss->ply)
|
||||
|| ss->ply >= MAX_PLY)
|
||||
return (ss->ply >= MAX_PLY && !ss->inCheck) ? evaluate(pos)
|
||||
: value_draw(pos.this_thread());
|
||||
: value_draw(pos.this_thread());
|
||||
|
||||
// Step 3. Mate distance pruning. Even if we mate at the next move our score
|
||||
// would be at best mate_in(ss->ply+1), but if alpha is already bigger because
|
||||
@@ -767,9 +767,10 @@ namespace {
|
||||
// Step 6. Static evaluation of the position
|
||||
if (ss->inCheck)
|
||||
{
|
||||
// Skip early pruning when in check
|
||||
ss->staticEval = eval = VALUE_NONE;
|
||||
improving = false;
|
||||
goto moves_loop; // Skip early pruning when in check
|
||||
goto moves_loop;
|
||||
}
|
||||
else if (ttHit)
|
||||
{
|
||||
@@ -1026,8 +1027,10 @@ moves_loop: // When in check, search starts from here
|
||||
if ( !givesCheck
|
||||
&& lmrDepth < 6
|
||||
&& !(PvNode && abs(bestValue) < 2)
|
||||
&& PieceValue[MG][type_of(movedPiece)] >= PieceValue[MG][type_of(pos.piece_on(to_sq(move)))]
|
||||
&& !ss->inCheck
|
||||
&& ss->staticEval + 267 + 391 * lmrDepth + PieceValue[MG][type_of(pos.piece_on(to_sq(move)))] <= alpha)
|
||||
&& ss->staticEval + 267 + 391 * lmrDepth
|
||||
+ PieceValue[MG][type_of(pos.piece_on(to_sq(move)))] <= alpha)
|
||||
continue;
|
||||
|
||||
// See based pruning
|
||||
@@ -1073,8 +1076,8 @@ moves_loop: // When in check, search starts from here
|
||||
else if (singularBeta >= beta)
|
||||
return singularBeta;
|
||||
|
||||
// If the eval of ttMove is greater than beta we try also if there is an other move that
|
||||
// pushes it over beta, if so also produce a cutoff
|
||||
// If the eval of ttMove is greater than beta we try also if there is another
|
||||
// move that pushes it over beta, if so also produce a cutoff.
|
||||
else if (ttValue >= beta)
|
||||
{
|
||||
ss->excludedMove = move;
|
||||
@@ -1152,7 +1155,7 @@ moves_loop: // When in check, search starts from here
|
||||
if (thisThread->ttHitAverage > 473 * TtHitAverageResolution * TtHitAverageWindow / 1024)
|
||||
r--;
|
||||
|
||||
// Reduction if other threads are searching this position.
|
||||
// Reduction if other threads are searching this position
|
||||
if (th.marked())
|
||||
r++;
|
||||
|
||||
@@ -1289,7 +1292,7 @@ moves_loop: // When in check, search starts from here
|
||||
rm.pv.push_back(*m);
|
||||
|
||||
// We record how often the best move has been changed in each
|
||||
// iteration. This information is used for time management: When
|
||||
// iteration. This information is used for time management: when
|
||||
// the best move changes frequently, we allocate some more time.
|
||||
if (moveCount > 1)
|
||||
++thisThread->bestMoveChanges;
|
||||
@@ -1523,7 +1526,7 @@ moves_loop: // When in check, search starts from here
|
||||
}
|
||||
}
|
||||
|
||||
// Don't search moves with negative SEE values
|
||||
// Do not search moves with negative SEE values
|
||||
if ( !ss->inCheck && !pos.see_ge(move))
|
||||
continue;
|
||||
|
||||
@@ -1576,7 +1579,7 @@ moves_loop: // When in check, search starts from here
|
||||
}
|
||||
}
|
||||
|
||||
// All legal moves have been searched. A special case: If we're in check
|
||||
// All legal moves have been searched. A special case: if we're in check
|
||||
// and no legal moves were found, it is checkmate.
|
||||
if (ss->inCheck && bestValue == -VALUE_INFINITE)
|
||||
return mated_in(ss->ply); // Plies to mate from the root
|
||||
@@ -1593,7 +1596,7 @@ moves_loop: // When in check, search starts from here
|
||||
|
||||
|
||||
// value_to_tt() adjusts a mate or TB score from "plies to mate from the root" to
|
||||
// "plies to mate from the current position". standard scores are unchanged.
|
||||
// "plies to mate from the current position". Standard scores are unchanged.
|
||||
// The function is called before storing a value in the transposition table.
|
||||
|
||||
Value value_to_tt(Value v, int ply) {
|
||||
@@ -1605,11 +1608,11 @@ moves_loop: // When in check, search starts from here
|
||||
}
|
||||
|
||||
|
||||
// value_from_tt() is the inverse of value_to_tt(): It adjusts a mate or TB score
|
||||
// from the transposition table (which refers to the plies to mate/be mated
|
||||
// from current position) to "plies to mate/be mated (TB win/loss) from the root".
|
||||
// However, for mate scores, to avoid potentially false mate scores related to the 50 moves rule,
|
||||
// and the graph history interaction, return an optimal TB score instead.
|
||||
// value_from_tt() is the inverse of value_to_tt(): it adjusts a mate or TB score
|
||||
// from the transposition table (which refers to the plies to mate/be mated from
|
||||
// current position) to "plies to mate/be mated (TB win/loss) from the root". However,
|
||||
// for mate scores, to avoid potentially false mate scores related to the 50 moves rule
|
||||
// and the graph history interaction, we return an optimal TB score instead.
|
||||
|
||||
Value value_from_tt(Value v, int ply, int r50c) {
|
||||
|
||||
@@ -1769,6 +1772,7 @@ moves_loop: // When in check, search starts from here
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
/// MainThread::check_time() is used to print debug info and, more importantly,
|
||||
/// to detect when we are out of available time and thus stop the search.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user