VVLTC Tune

Passed VVLTC with stc bounds:
LLR: 2.94 (-2.94,2.94) <0.00,2.00>
Total: 69810 W: 18119 L: 17814 D: 33877
Ptnml(0-2): 6, 6222, 22144, 6527, 6
https://tests.stockfishchess.org/tests/view/69b43f666c456d3a77a50a5d

Passed VVLTC with ltc bounds:
LLR: 2.95 (-2.94,2.94) <0.50,2.50>
Total: 52458 W: 13574 L: 13258 D: 25626
Ptnml(0-2): 5, 4632, 16636, 4954, 2
https://tests.stockfishchess.org/tests/view/69b16dfbd0c9228834e88e99

closes https://github.com/official-stockfish/Stockfish/pull/6669

Bench: 3164843
This commit is contained in:
FauziAkram
2026-03-18 20:49:06 +01:00
committed by Disservin
parent 67a2c247d4
commit add173263d
2 changed files with 105 additions and 105 deletions
+98 -98
View File
@@ -89,7 +89,7 @@ int correction_value(const Worker& w, const Position& pos, const Stack* const ss
+ (*(ss - 4)->continuationCorrectionHistory)[pos.piece_on(m.to_sq())][m.to_sq()]
: 8;
return 11433 * pcv + 8823 * micv + 12749 * (wnpcv + bnpcv) + 8022 * cntcv;
return 12153 * pcv + 8620 * micv + 12355 * (wnpcv + bnpcv) + 7982 * cntcv;
}
// Add correctionHistory value to raw staticEval and guarantee evaluation
@@ -105,11 +105,11 @@ void update_correction_history(const Position& pos,
const Move m = (ss - 1)->currentMove;
const Color us = pos.side_to_move();
constexpr int nonPawnWeight = 181;
constexpr int nonPawnWeight = 187;
auto& shared = workerThread.sharedHistory;
shared.pawn_correction_entry(pos).at(us).pawn << bonus;
shared.minor_piece_correction_entry(pos).at(us).minor << bonus * 155 / 128;
shared.minor_piece_correction_entry(pos).at(us).minor << bonus * 153 / 128;
shared.nonpawn_correction_entry<WHITE>(pos).at(us).nonPawnWhite << bonus * nonPawnWeight / 128;
shared.nonpawn_correction_entry<BLACK>(pos).at(us).nonPawnBlack << bonus * nonPawnWeight / 128;
@@ -117,8 +117,8 @@ void update_correction_history(const Position& pos,
const int mask = int(m.is_ok());
const Square to = m.to_sq_unchecked();
const Piece pc = pos.piece_on(to);
const int bonus2 = (bonus * 129 / 128) * mask;
const int bonus4 = (bonus * 61 / 128) * mask;
const int bonus2 = (bonus * 126 / 128) * mask;
const int bonus4 = (bonus * 63 / 128) * mask;
(*(ss - 2)->continuationCorrectionHistory)[pc][to] << bonus2;
(*(ss - 4)->continuationCorrectionHistory)[pc][to] << bonus4;
}
@@ -144,7 +144,7 @@ void update_all_stats(const Position& pos,
bool is_shuffling(Move move, Stack* const ss, const Position& pos) {
if (pos.capture_stage(move) || pos.rule50_count() < 11)
return false;
if (pos.state()->pliesFromNull <= 6 || ss->ply < 19)
if (pos.state()->pliesFromNull <= 6 || ss->ply < 18)
return false;
return move.from_sq() == (ss - 2)->currentMove.to_sq()
&& (ss - 2)->currentMove.from_sq() == (ss - 4)->currentMove.to_sq();
@@ -311,11 +311,11 @@ void Search::Worker::iterative_deepening() {
int searchAgainCounter = 0;
lowPlyHistory.fill(100);
lowPlyHistory.fill(98);
for (Color c : {WHITE, BLACK})
for (int i = 0; i < UINT_16_HISTORY_SIZE; i++)
mainHistory[c][i] = mainHistory[c][i] * 778 / 1024;
mainHistory[c][i] = mainHistory[c][i] * 820 / 1024;
// Iterative deepening loop until requested to stop or the target depth is reached
while (++rootDepth < MAX_PLY && !threads.stop
@@ -351,13 +351,13 @@ void Search::Worker::iterative_deepening() {
selDepth = 0;
// Reset aspiration window starting size
delta = 5 + threadIdx % 8 + std::abs(rootMoves[pvIdx].meanSquaredScore) / 9968;
delta = 5 + threadIdx % 8 + std::abs(rootMoves[pvIdx].meanSquaredScore) / 10208;
Value avg = rootMoves[pvIdx].averageScore;
alpha = std::max(avg - delta, -VALUE_INFINITE);
beta = std::min(avg + delta, VALUE_INFINITE);
// Adjust optimism based on root move's averageScore
optimism[us] = 142 * avg / (std::abs(avg) + 86);
optimism[us] = 144 * avg / (std::abs(avg) + 91);
optimism[~us] = -optimism[us];
// Start with a small aspiration window and, in the case of a fail
@@ -503,29 +503,29 @@ void Search::Worker::iterative_deepening() {
uint64_t nodesEffort =
rootMoves[0].effort * 100000 / std::max(size_t(1), size_t(nodes));
double fallingEval = (11.85 + 2.24 * (mainThread->bestPreviousAverageScore - bestValue)
+ 0.93 * (mainThread->iterValue[iterIdx] - bestValue))
double fallingEval = (12.44 + 2.318 * (mainThread->bestPreviousAverageScore - bestValue)
+ 0.95 * (mainThread->iterValue[iterIdx] - bestValue))
/ 100.0;
fallingEval = std::clamp(fallingEval, 0.57, 1.70);
fallingEval = std::clamp(fallingEval, 0.581, 1.655);
// If the bestMove is stable over several iterations, reduce time accordingly
double k = 0.51;
double center = lastBestMoveDepth + 12.15;
double k = 0.476;
double center = lastBestMoveDepth + 11.565;
timeReduction = 0.66 + 0.85 / (0.98 + std::exp(-k * (completedDepth - center)));
timeReduction = 0.64 + 0.93 / (0.953 + std::exp(-k * (completedDepth - center)));
double reduction = (1.43 + mainThread->previousTimeReduction) / (2.28 * timeReduction);
double reduction = (1.5 + mainThread->previousTimeReduction) / (2.255 * timeReduction);
double bestMoveInstability = 1.02 + 2.14 * totBestMoveChanges / threads.size();
double bestMoveInstability = 1.088 + 2.315 * totBestMoveChanges / threads.size();
double highBestMoveEffort = nodesEffort >= 93340 ? 0.76 : 1.0;
double highBestMoveEffort = nodesEffort > 86000 ? 0.74 : 0.96;
double totalTime = mainThread->tm.optimum() * fallingEval * reduction
* bestMoveInstability * highBestMoveEffort;
// Cap used time in case of a single legal move for a better viewer experience
if (rootMoves.size() == 1)
totalTime = std::min(502.0, totalTime);
totalTime = std::min(504.4, totalTime);
auto elapsedTime = elapsed();
@@ -601,7 +601,7 @@ void Search::Worker::undo_null_move(Position& pos) { pos.undo_null_move(); }
// Reset histories, usually before a new game
void Search::Worker::clear() {
mainHistory.fill(0);
captureHistory.fill(-689);
captureHistory.fill(-678);
// Each thread is responsible for clearing their part of shared history
sharedHistory.correctionHistory.clear_range(0, numaThreadIdx, numaTotal);
@@ -611,16 +611,16 @@ void Search::Worker::clear() {
for (auto& to : continuationCorrectionHistory)
for (auto& h : to)
h.fill(7);
h.fill(6);
for (bool inCheck : {false, true})
for (StatsType c : {NoCaptures, Captures})
for (auto& to : continuationHistory[inCheck][c])
for (auto& h : to)
h.fill(-541);
h.fill(-523);
for (size_t i = 1; i < reductions.size(); ++i)
reductions[i] = int(2809 / 128.0 * std::log(i));
reductions[i] = int(2763 / 128.0 * std::log(i));
refreshTable.clear(networks[numaAccessToken]);
}
@@ -773,7 +773,7 @@ Value Search::Worker::search(
// Hindsight adjustment of reductions based on static evaluation difference.
if (priorReduction >= 3 && !opponentWorsening)
depth++;
if (priorReduction >= 2 && depth >= 2 && ss->staticEval + (ss - 1)->staticEval > 188)
if (priorReduction >= 2 && depth >= 2 && ss->staticEval + (ss - 1)->staticEval > 195)
depth--;
// At non-PV nodes we check for an early TT cutoff
@@ -788,11 +788,11 @@ Value Search::Worker::search(
// Bonus for a quiet ttMove that fails high
if (!ttCapture)
update_quiet_histories(pos, ss, *this, ttData.move,
std::min(121 * depth - 75, 932));
std::min(119 * depth - 74, 855));
// Extra penalty for early quiet moves of the previous ply
if (prevSq != SQ_NONE && (ss - 1)->moveCount < 4 && !priorCapture)
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -2104);
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -2014);
}
// Partial workaround for the graph history interaction problem
@@ -879,38 +879,38 @@ Value Search::Worker::search(
// Use static evaluation difference to improve quiet move ordering
if (((ss - 1)->currentMove).is_ok() && !(ss - 1)->inCheck && !priorCapture)
{
int evalDiff = std::clamp(-int((ss - 1)->staticEval + ss->staticEval), -213, 175) + 59;
int evalDiff = std::clamp(-int((ss - 1)->staticEval + ss->staticEval), -214, 171) + 60;
mainHistory[~us][((ss - 1)->currentMove).raw()] << evalDiff * 10;
if (!ttHit && type_of(pos.piece_on(prevSq)) != PAWN
&& ((ss - 1)->currentMove).type_of() != PROMOTION)
sharedHistory.pawn_entry(pos)[pos.piece_on(prevSq)][prevSq] << evalDiff * 13;
sharedHistory.pawn_entry(pos)[pos.piece_on(prevSq)][prevSq] << evalDiff * 12;
}
// Step 7. Razoring
// If eval is really low, skip search entirely and return the qsearch value.
// For PvNodes, we must have a guard against mates being returned.
if (!PvNode && eval < alpha - 507 - 312 * depth * depth)
if (!PvNode && eval < alpha - 502 - 306 * depth * depth)
return qsearch<NonPV>(pos, ss, alpha, beta);
// Step 8. Futility pruning: child node
// The depth condition is important for mate finding.
{
auto futility_margin = [&](Depth d) {
Value futilityMult = 77 - 22 * !ss->ttHit;
Value futilityMult = 76 - 21 * !ss->ttHit;
return futilityMult * d
- (2661 * improving + 355 * opponentWorsening) * futilityMult / 1024 //
+ std::abs(correctionValue) / 176900;
- (2686 * improving + 362 * opponentWorsening) * futilityMult / 1024 //
+ std::abs(correctionValue) / 180600;
};
if (!ss->ttPv && depth < 16 && eval - futility_margin(depth) >= beta && eval >= beta
if (!ss->ttPv && depth < 15 && eval - futility_margin(depth) >= beta && eval >= beta
&& (!ttData.move || ttCapture) && !is_loss(beta) && !is_win(eval))
return (2 * beta + eval) / 3;
}
// Step 9. Null move search with verification search
if (cutNode && ss->staticEval >= beta - 17 * depth - 50 * improving + 359 && !excludedMove
if (cutNode && ss->staticEval >= beta - 16 * depth - 53 * improving + 378 && !excludedMove
&& pos.non_pawn_material(us) && ss->ply >= nmpMinPly && !is_loss(beta))
{
assert((ss - 1)->currentMove != Move::null());
@@ -955,7 +955,7 @@ Value Search::Worker::search(
// Step 11. ProbCut
// If we have a good enough capture (or queen promotion) and a reduced search
// returns a value much above beta, we can (almost) safely prune the previous move.
probCutBeta = beta + 229 - 63 * improving;
probCutBeta = beta + 224 - 61 * improving;
if (depth >= 3
&& !is_decisive(beta)
// If value from transposition table is lower than probCutBeta, don't attempt
@@ -1064,7 +1064,7 @@ moves_loop: // When in check, search starts here
// Increase reduction for ttPv nodes (*Scaler)
// Larger values scale well
if (ss->ttPv)
r += 949;
r += 1013;
// Step 14. Pruning at shallow depths.
// Depth conditions are important for mate finding.
@@ -1085,8 +1085,8 @@ moves_loop: // When in check, search starts here
// Futility pruning for captures
if (!givesCheck && lmrDepth < 7)
{
Value futilityValue = ss->staticEval + 235 + 211 * lmrDepth
+ PieceValue[capturedPiece] + 126 * captHist / 1024;
Value futilityValue = ss->staticEval + 218 + 223 * lmrDepth
+ PieceValue[capturedPiece] + 131 * captHist / 1024;
if (futilityValue <= alpha)
continue;
@@ -1094,7 +1094,7 @@ moves_loop: // When in check, search starts here
// SEE based pruning for captures and checks
// Avoid pruning sacrifices of our last piece for stalemate
int margin = std::max(185 * depth + captHist / 28, 0);
int margin = std::max(167 * depth + captHist * 34 / 1024, 0);
if ((alpha >= VALUE_DRAW || pos.non_pawn_material(us) != PieceValue[movedPiece])
&& !pos.see_ge(move, -margin))
continue;
@@ -1106,15 +1106,15 @@ moves_loop: // When in check, search starts here
+ sharedHistory.pawn_entry(pos)[movedPiece][move.to_sq()];
// Continuation history based pruning
if (history < -3826 * depth)
if (history < -4097 * depth)
continue;
history += 73 * mainHistory[us][move.raw()] / 32;
history += 71 * mainHistory[us][move.raw()] / 32;
// (*Scaler): Generally, lower divisors scales well
lmrDepth += history / 2917;
lmrDepth += history / 2995;
Value futilityValue = ss->staticEval + 42 + 157 * !bestMove + 120 * lmrDepth
Value futilityValue = ss->staticEval + 42 + 151 * !bestMove + 120 * lmrDepth
+ 86 * (ss->staticEval > alpha);
// Futility pruning: parent node
@@ -1150,7 +1150,7 @@ moves_loop: // When in check, search starts here
&& is_valid(ttData.value) && !is_decisive(ttData.value) && (ttData.bound & BOUND_LOWER)
&& ttData.depth >= depth - 3 && !is_shuffling(move, ss, pos))
{
Value singularBeta = ttData.value - (58 + 67 * (ss->ttPv && !PvNode)) * depth / 57;
Value singularBeta = ttData.value - (60 + 66 * (ss->ttPv && !PvNode)) * depth / 55;
Depth singularDepth = newDepth / 2;
ss->excludedMove = move;
@@ -1159,11 +1159,11 @@ moves_loop: // When in check, search starts here
if (value < singularBeta)
{
int corrValAdj = std::abs(correctionValue) / 220870;
int doubleMargin = -4 + 213 * PvNode - 196 * !ttCapture - corrValAdj
- 943 * ttMoveHistory / 123477 - (ss->ply > rootDepth) * 45;
int tripleMargin = 73 + 324 * PvNode - 229 * !ttCapture + 87 * ss->ttPv - corrValAdj
- (ss->ply > rootDepth) * 50;
int corrValAdj = std::abs(correctionValue) / 210590;
int doubleMargin = -4 + 212 * PvNode - 182 * !ttCapture - corrValAdj
- 906 * ttMoveHistory / 116517 - (ss->ply > rootDepth) * 44;
int tripleMargin = 73 + 320 * PvNode - 218 * !ttCapture + 92 * ss->ttPv - corrValAdj
- (ss->ply > rootDepth) * 45;
extension =
1 + (value < singularBeta - doubleMargin) + (value < singularBeta - tripleMargin);
@@ -1179,7 +1179,7 @@ moves_loop: // When in check, search starts here
// subtree by returning a softbound.
else if (value >= beta && !is_decisive(value))
{
ttMoveHistory << std::max(-394 - 105 * depth, -3692);
ttMoveHistory << std::max(-424 - 107 * depth, -3375);
return value;
}
@@ -1209,31 +1209,31 @@ moves_loop: // When in check, search starts here
// Decrease reduction for PvNodes (*Scaler)
if (ss->ttPv)
r -= 2823 + PvNode * 1013 + (ttData.value > alpha) * 910
+ (ttData.depth >= depth) * (933 + cutNode * 979);
r -= 2819 + PvNode * 973 + (ttData.value > alpha) * 905
+ (ttData.depth >= depth) * (935 + cutNode * 959);
r += 690; // Base reduction offset to compensate for other tweaks
r -= moveCount * 70;
r -= std::abs(correctionValue) / 26878;
r += 691; // Base reduction offset to compensate for other tweaks
r -= moveCount * 65;
r -= std::abs(correctionValue) / 25600;
// Increase reduction for cut nodes
if (cutNode)
r += 3582 + 1015 * !ttData.move;
r += 3611 + 985 * !ttData.move;
// Increase reduction if ttMove is a capture
if (ttCapture)
r += 1075;
r += 1054;
// Increase reduction if next ply has a lot of fail high
if ((ss + 1)->cutoffCnt > 1)
r += 249 + 1073 * ((ss + 1)->cutoffCnt > 2) + 1064 * allNode;
r += 251 + 1124 * ((ss + 1)->cutoffCnt > 2) + 1042 * allNode;
// For first picked move (ttMove) reduce reduction
if (move == ttData.move)
r -= 2069;
r -= 2239;
if (capture)
ss->statScore = 892 * int(PieceValue[pos.captured_piece()]) / 128
ss->statScore = 863 * int(PieceValue[pos.captured_piece()]) / 128
+ captureHistory[movedPiece][move.to_sq()][type_of(pos.captured_piece())];
else
ss->statScore = 2 * mainHistory[us][move.raw()]
@@ -1241,11 +1241,11 @@ moves_loop: // When in check, search starts here
+ (*contHist[1])[movedPiece][move.to_sq()];
// Decrease/increase reduction for moves with a good/bad history
r -= ss->statScore * 454 / 4096;
r -= ss->statScore * 428 / 4096;
// Scale up reductions for expected ALL nodes
if (allNode)
r += r * 276 / (256 * depth + 254);
r += r * 273 / (256 * depth + 260);
// Step 17. Late moves reduction / extension (LMR)
if (depth >= 2 && moveCount > 1)
@@ -1267,7 +1267,7 @@ moves_loop: // When in check, search starts here
{
// Adjust full-depth search based on LMR results - if the result was
// good enough search deeper, if it was bad enough search shallower.
const bool doDeeperSearch = d < newDepth && value > bestValue + 50;
const bool doDeeperSearch = d < newDepth && value > bestValue + 48;
const bool doShallowerSearch = value < bestValue + 9;
newDepth += doDeeperSearch - doShallowerSearch;
@@ -1276,7 +1276,7 @@ moves_loop: // When in check, search starts here
value = -search<NonPV>(pos, ss + 1, -(alpha + 1), -alpha, newDepth, !cutNode);
// Post LMR continuation history updates
update_continuation_histories(ss, movedPiece, move.to_sq(), 1342);
update_continuation_histories(ss, movedPiece, move.to_sq(), 1426);
}
}
@@ -1285,11 +1285,11 @@ moves_loop: // When in check, search starts here
{
// Increase reduction if ttMove is not present
if (!ttData.move)
r += 993;
r += 1057;
// Note that if expected reduction is high, we reduce search depth here
value = -search<NonPV>(pos, ss + 1, -(alpha + 1), -alpha,
newDepth - (r > 4302) - (r > 5919 && newDepth > 2), !cutNode);
newDepth - (r > 4628) - (r > 5772 && newDepth > 2), !cutNode);
}
// For PV nodes only, do a full PV search on the first move or after a fail high,
@@ -1437,31 +1437,31 @@ moves_loop: // When in check, search starts here
update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth,
ttData.move);
if (!PvNode)
ttMoveHistory << (bestMove == ttData.move ? 804 : -860);
ttMoveHistory << (bestMove == ttData.move ? 805 : -787);
}
// Bonus for prior quiet countermove that caused the fail low
else if (!priorCapture && prevSq != SQ_NONE)
{
int bonusScale = -227;
bonusScale -= (ss - 1)->statScore / 101;
bonusScale += std::min(58 * depth, 488);
bonusScale += 172 * ((ss - 1)->moveCount > 8);
bonusScale += 150 * (!ss->inCheck && bestValue <= ss->staticEval - 113);
bonusScale += 154 * (!(ss - 1)->inCheck && bestValue <= -(ss - 1)->staticEval - 68);
int bonusScale = -232;
bonusScale -= (ss - 1)->statScore / 108;
bonusScale += std::min(59 * depth, 454);
bonusScale += 169 * ((ss - 1)->moveCount > 8);
bonusScale += 145 * (!ss->inCheck && bestValue <= ss->staticEval - 110);
bonusScale += 154 * (!(ss - 1)->inCheck && bestValue <= -(ss - 1)->staticEval - 73);
bonusScale = std::max(bonusScale, 0);
// scaledBonus ranges from 0 to roughly 2.3M, overflows happen for multipliers larger than 900
const int scaledBonus = std::min(137 * depth - 79, 1394) * bonusScale;
const int scaledBonus = std::min(135 * depth - 80, 1400) * bonusScale;
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq,
scaledBonus * 222 / 16384);
scaledBonus * 221 / 16384);
mainHistory[~us][((ss - 1)->currentMove).raw()] << scaledBonus * 221 / 32768;
mainHistory[~us][((ss - 1)->currentMove).raw()] << scaledBonus * 235 / 32768;
if (type_of(pos.piece_on(prevSq)) != PAWN && ((ss - 1)->currentMove).type_of() != PROMOTION)
sharedHistory.pawn_entry(pos)[pos.piece_on(prevSq)][prevSq] << scaledBonus * 286 / 8192;
sharedHistory.pawn_entry(pos)[pos.piece_on(prevSq)][prevSq] << scaledBonus * 290 / 8192;
}
// Bonus for prior capture countermove that caused the fail low
@@ -1469,7 +1469,7 @@ moves_loop: // When in check, search starts here
{
Piece capturedPiece = pos.captured_piece();
assert(capturedPiece != NO_PIECE);
captureHistory[pos.piece_on(prevSq)][prevSq][type_of(capturedPiece)] << 993;
captureHistory[pos.piece_on(prevSq)][prevSq][type_of(capturedPiece)] << 1018;
}
if (PvNode)
@@ -1495,9 +1495,9 @@ moves_loop: // When in check, search starts here
if (!ss->inCheck && !(bestMove && pos.capture(bestMove))
&& (bestValue > ss->staticEval) == bool(bestMove))
{
auto bonus = std::clamp(int(bestValue - ss->staticEval) * depth / (bestMove ? 10 : 8),
auto bonus = std::clamp(int(bestValue - ss->staticEval) * depth * (bestMove ? 12 : 17) / 128,
-CORRECTION_HISTORY_LIMIT / 4, CORRECTION_HISTORY_LIMIT / 4);
update_correction_history(pos, ss, *this, bonus);
update_correction_history(pos, ss, *this, 1069 * bonus / 1024);
}
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
@@ -1621,7 +1621,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
if (bestValue > alpha)
alpha = bestValue;
futilityBase = ss->staticEval + 351;
futilityBase = ss->staticEval + 328;
}
const PieceToHistory* contHist[] = {(ss - 1)->continuationHistory};
@@ -1682,7 +1682,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
continue;
// Do not search moves with bad enough SEE values
if (!pos.see_ge(move, -72))
if (!pos.see_ge(move, -73))
continue;
}
@@ -1754,7 +1754,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
Depth Search::Worker::reduction(bool i, Depth d, int mn, int delta) const {
int reductionScale = reductions[d] * reductions[mn];
return reductionScale - delta * 576 / rootDelta + !i * reductionScale * 217 / 512 + 1182;
return reductionScale - delta * 585 / rootDelta + !i * reductionScale * 206 / 512 + 1133;
}
// elapsed() returns the time elapsed since the search started. If the
@@ -1850,18 +1850,18 @@ void update_all_stats(const Position& pos,
PieceType capturedPiece;
int bonus =
std::min(124 * depth - 84, 1376) + 349 * (bestMove == ttMove) + (ss - 1)->statScore / 32;
int malus = std::min(872 * depth - 212, 2104);
std::min(128 * depth - 77, 1529) + 353 * (bestMove == ttMove) + (ss - 1)->statScore / 32;
int malus = std::min(882 * depth - 204, 2122);
if (!pos.capture_stage(bestMove))
{
update_quiet_histories(pos, ss, workerThread, bestMove, bonus * 810 / 1024);
update_quiet_histories(pos, ss, workerThread, bestMove, bonus * 806 / 1024);
int actualMalus = malus * 1159 / 1024;
int actualMalus = malus * 1113 / 1024;
// Decrease stats for all non-best quiet moves
for (Move move : quietsSearched)
{
actualMalus = actualMalus * 963 / 1024;
actualMalus = actualMalus * 977 / 1024;
update_quiet_histories(pos, ss, workerThread, move, -actualMalus);
}
}
@@ -1869,20 +1869,20 @@ void update_all_stats(const Position& pos,
{
// Increase stats for the best move in case it was a capture move
capturedPiece = type_of(pos.piece_on(bestMove.to_sq()));
captureHistory[movedPiece][bestMove.to_sq()][capturedPiece] << bonus * 1290 / 1024;
captureHistory[movedPiece][bestMove.to_sq()][capturedPiece] << bonus * 1286 / 1024;
}
// Extra penalty for a quiet early move that was not a TT move in
// previous ply when it gets refuted.
if (prevSq != SQ_NONE && ((ss - 1)->moveCount == 1 + (ss - 1)->ttHit) && !pos.captured_piece())
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -malus * 596 / 1024);
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -malus * 616 / 1024);
// Decrease stats for all non-best capture moves
for (Move move : capturesSearched)
{
movedPiece = pos.moved_piece(move);
capturedPiece = type_of(pos.piece_on(move.to_sq()));
captureHistory[movedPiece][move.to_sq()][capturedPiece] << -malus * 1561 / 1024;
captureHistory[movedPiece][move.to_sq()][capturedPiece] << -malus * 1559 / 1024;
}
}
@@ -1891,10 +1891,10 @@ void update_all_stats(const Position& pos,
// at ply -1, -2, -3, -4, and -6 with current move.
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) {
static constexpr std::array<ConthistBonus, 6> conthist_bonuses = {
{{1, 1106}, {2, 705}, {3, 316}, {4, 572}, {5, 126}, {6, 427}}};
{{1, 1071}, {2, 753}, {3, 329}, {4, 539}, {5, 124}, {6, 434}}};
// Multipliers for positive history consistency
constexpr int CMHCMultipliers[] = {87, 94, 106, 118, 114, 128, 128};
constexpr int CMHCMultipliers[] = {96, 100, 100, 100, 115, 118, 129};
int positiveCount = 0;
for (const auto [i, weight] : conthist_bonuses)
@@ -1910,7 +1910,7 @@ void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) {
positiveCount++;
int multiplier = CMHCMultipliers[positiveCount];
historyEntry << (bonus * weight * multiplier / 131072) + 82 * (i < 2);
historyEntry << (bonus * weight * multiplier / 131072) + 73 * (i < 2);
}
}
}
@@ -1924,12 +1924,12 @@ void update_quiet_histories(
workerThread.mainHistory[us][move.raw()] << bonus; // Untuned to prevent duplicate effort
if (ss->ply < LOW_PLY_HISTORY_SIZE)
workerThread.lowPlyHistory[ss->ply][move.raw()] << bonus * 714 / 1024;
workerThread.lowPlyHistory[ss->ply][move.raw()] << bonus * 682 / 1024;
update_continuation_histories(ss, pos.moved_piece(move), move.to_sq(), bonus * 898 / 1024);
update_continuation_histories(ss, pos.moved_piece(move), move.to_sq(), bonus * 894 / 1024);
workerThread.sharedHistory.pawn_entry(pos)[pos.moved_piece(move)][move.to_sq()]
<< bonus * (bonus > 0 ? 967 : 535) / 1024;
<< bonus * (bonus > 0 ? 974 : 543) / 1024;
}
}
+7 -7
View File
@@ -106,18 +106,18 @@ void TimeManagement::init(Search::LimitsType& limits,
{
// Extra time according to timeLeft
if (originalTimeAdjust < 0)
originalTimeAdjust = 0.3128 * std::log10(timeLeft) - 0.4354;
originalTimeAdjust = 0.3272 * std::log10(timeLeft) - 0.4141;
// Calculate time constants based on current time left.
double logTimeInSec = std::log10(scaledTime / 1000.0);
double optConstant = std::min(0.0032116 + 0.000321123 * logTimeInSec, 0.00508017);
double maxConstant = std::max(3.3977 + 3.03950 * logTimeInSec, 2.94761);
double optConstant = std::min(0.0029869 + 0.00033554 * logTimeInSec, 0.004905);
double maxConstant = std::max(3.3744 + 3.0608 * logTimeInSec, 3.1441);
optScale = std::min(0.0121431 + std::pow(ply + 2.94693, 0.461073) * optConstant,
0.213035 * limits.time[us] / timeLeft)
optScale = std::min(0.012112 + std::pow(ply + 3.22713, 0.46866) * optConstant,
0.19404 * limits.time[us] / timeLeft)
* originalTimeAdjust;
maxScale = std::min(6.67704, maxConstant + ply / 11.9847);
maxScale = std::min(6.873, maxConstant + ply / 12.352);
}
// x moves in y seconds (+ z increment)
@@ -131,7 +131,7 @@ void TimeManagement::init(Search::LimitsType& limits,
// Limit the maximum possible time for this move
optimumTime = TimePoint(std::max(1.0, optScale * timeLeft));
maximumTime =
TimePoint(std::max(double(optimumTime), std::min(0.825179 * limits.time[us] - moveOverhead,
TimePoint(std::max(double(optimumTime), std::min(0.8097 * limits.time[us] - moveOverhead,
maxScale * optimumTime)));
if (options["Ponder"])