return Value((175 - 50 * improving) * d / ONE_PLY);
}
- // Margin for pruning capturing moves: almost linear in depth
- constexpr int CapturePruneMargin[] = { 0,
- 1 * PawnValueEg * 1055 / 1000,
- 2 * PawnValueEg * 1042 / 1000,
- 3 * PawnValueEg * 963 / 1000,
- 4 * PawnValueEg * 1038 / 1000,
- 5 * PawnValueEg * 950 / 1000,
- 6 * PawnValueEg * 930 / 1000
- };
-
// Futility and reductions lookup tables, initialized at startup
int FutilityMoveCounts[2][16]; // [improving][depth]
int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber]
MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr);
double timeReduction = 1.0;
Color us = rootPos.side_to_move();
+ bool failedLow;
std::memset(ss-4, 0, 7 * sizeof(Stack));
for (int i = 4; i > 0; i--)
beta = VALUE_INFINITE;
if (mainThread)
- mainThread->bestMoveChanges = 0, mainThread->failedLow = false;
+ mainThread->bestMoveChanges = 0, failedLow = false;
size_t multiPV = Options["MultiPV"];
Skill skill(Options["Skill Level"]);
// Age out PV variability metric
if (mainThread)
- mainThread->bestMoveChanges *= 0.517, mainThread->failedLow = false;
+ mainThread->bestMoveChanges *= 0.517, failedLow = false;
// Save the last iteration's scores before first PV line is searched and
// all the move scores except the (new) PV are set to -VALUE_INFINITE.
if (mainThread)
{
- mainThread->failedLow = true;
+ failedLow = true;
Threads.stopOnPonderhit = false;
}
}
&& !Threads.stop
&& !Threads.stopOnPonderhit)
{
- const int F[] = { mainThread->failedLow,
+ const int F[] = { failedLow,
bestValue - mainThread->previousScore };
int improvingFactor = std::max(246, std::min(832, 306 + 119 * F[0] - 6 * F[1]));
constexpr bool PvNode = NT == PV;
const bool rootNode = PvNode && ss->ply == 0;
- // Check if we have an upcoming move which draws by repetition, or
+ // Check if we have an upcoming move which draws by repetition, or
// if the opponent had an alternative move earlier to this position.
if ( pos.rule50_count() >= 3
&& alpha < VALUE_DRAW
continue;
// Prune moves with negative SEE (~10 Elo)
- if ( lmrDepth < 8
- && !pos.see_ge(move, Value(-35 * lmrDepth * lmrDepth)))
+ if (!pos.see_ge(move, Value(-29 * lmrDepth * lmrDepth)))
continue;
}
- else if ( depth < 7 * ONE_PLY // (~20 Elo)
- && !extension
- && !pos.see_ge(move, -Value(CapturePruneMargin[depth / ONE_PLY])))
+ else if ( !extension // (~20 Elo)
+ && !pos.see_ge(move, -PawnValueEg * (depth / ONE_PLY)))
continue;
}
{
// Quiet best move: update move sorting heuristics
if (!pos.capture_or_promotion(bestMove))
- update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth));
+ update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount,
+ stat_bonus(depth + (bestValue > beta + PawnValueMg ? ONE_PLY : DEPTH_ZERO)));
else
- update_capture_stats(pos, bestMove, capturesSearched, captureCount,
- stat_bonus(depth + (bestValue > beta + KnightValueMg ? ONE_PLY : DEPTH_ZERO)));
+ update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY));
// Extra penalty for a quiet TT move in previous ply when it gets refuted
if ((ss-1)->moveCount == 1 && !pos.captured_piece())