@@ -59,9 +59,9 @@ static constexpr double EvalLevel[10] = {0.981, 0.956, 0.895, 0.949, 0.913,
5959
6060// Futility margin
6161Value futility_margin (Depth d, bool noTtCutNode, bool improving, bool oppWorsening) {
62- Value futilityMult = 131 - 48 * noTtCutNode;
63- Value improvingDeduction = 2 * improving * futilityMult;
64- Value worseningDeduction = 330 * oppWorsening * futilityMult / 1024 ;
62+ Value futilityMult = 127 - 48 * noTtCutNode;
63+ Value improvingDeduction = 65 * improving * futilityMult / 32 ;
64+ Value worseningDeduction = 334 * oppWorsening * futilityMult / 1024 ;
6565
6666 return futilityMult * d - improvingDeduction - worseningDeduction;
6767}
@@ -73,15 +73,15 @@ constexpr int futility_move_count(bool improving, Depth depth) {
7373// Add correctionHistory value to raw staticEval and guarantee evaluation does not hit the tablebase range
7474Value to_corrected_static_eval (Value v, const Worker& w, const Position& pos) {
7575 auto cv = w.correctionHistory [pos.side_to_move ()][pawn_structure_index<Correction>(pos)];
76- v += cv * std::abs (cv) / 7179 ;
76+ v += cv * std::abs (cv) / 6047 ;
7777 return std::clamp (v, VALUE_TB_LOSS_IN_MAX_PLY + 1 , VALUE_TB_WIN_IN_MAX_PLY - 1 );
7878}
7979
8080// History and stats update bonus, based on depth
81- int stat_bonus (Depth d) { return std::clamp (200 * d - 280 , 16 , 1495 ); }
81+ int stat_bonus (Depth d) { return std::clamp (187 * d - 288 , 17 , 1548 ); }
8282
8383// History and stats update malus, based on depth
84- int stat_malus (Depth d) { return (d < 4 ? 586 * d - 284 : 1639 ); }
84+ int stat_malus (Depth d) { return (d < 4 ? 630 * d - 281 : 1741 ); }
8585
8686// Add a small random component to draw evaluations to avoid 3-fold blindness
8787Value value_draw (size_t nodes) { return VALUE_DRAW - 1 + Value (nodes & 0x2 ); }
@@ -311,12 +311,12 @@ void Search::Worker::iterative_deepening() {
311311
312312 // Reset aspiration window starting size
313313 Value avg = rootMoves[pvIdx].averageScore ;
314- delta = 10 + avg * avg / 9474 ;
314+ delta = 10 + avg * avg / 9828 ;
315315 alpha = std::max (avg - delta, -VALUE_INFINITE);
316316 beta = std::min (avg + delta, VALUE_INFINITE);
317317
318318 // Adjust optimism based on root move's averageScore (~4 Elo)
319- optimism[us] = 117 * avg / (std::abs (avg) + 88 );
319+ optimism[us] = 116 * avg / (std::abs (avg) + 84 );
320320 optimism[~us] = -optimism[us];
321321
322322 // Start with a small aspiration window and, in the case of a fail
@@ -503,10 +503,10 @@ void Search::Worker::clear() {
503503 for (StatsType c : {NoCaptures, Captures})
504504 for (auto & to : continuationHistory[inCheck][c])
505505 for (auto & h : to)
506- h->fill (-62 );
506+ h->fill (-60 );
507507
508508 for (size_t i = 1 ; i < reductions.size (); ++i)
509- reductions[i] = int ((21.19 + std::log (size_t (options[" Threads" ])) / 2 ) * std::log (i));
509+ reductions[i] = int ((21.69 + std::log (size_t (options[" Threads" ])) / 2 ) * std::log (i));
510510
511511 refreshTable.clear (networks);
512512}
@@ -739,7 +739,7 @@ Value Search::Worker::search(
739739 // Use static evaluation difference to improve quiet move ordering (~9 Elo)
740740 if (((ss - 1 )->currentMove ).is_ok () && !(ss - 1 )->inCheck && !priorCapture)
741741 {
742- int bonus = std::clamp (-12 * int ((ss - 1 )->staticEval + ss->staticEval ), -1749 , 1584 );
742+ int bonus = std::clamp (-11 * int ((ss - 1 )->staticEval + ss->staticEval ), -1729 , 1517 );
743743 bonus = bonus > 0 ? 2 * bonus : bonus / 2 ;
744744 thisThread->mainHistory [~us][((ss - 1 )->currentMove ).from_to ()] << bonus;
745745 if (type_of (pos.piece_on (prevSq)) != PAWN && ((ss - 1 )->currentMove ).type_of () != PROMOTION)
@@ -762,7 +762,7 @@ Value Search::Worker::search(
762762 // If eval is really low check with qsearch if it can exceed alpha, if it can't,
763763 // return a fail low.
764764 // Adjust razor margin according to cutoffCnt. (~1 Elo)
765- if (eval < alpha - 473 - (308 - 138 * ((ss + 1 )->cutoffCnt > 3 )) * depth * depth)
765+ if (eval < alpha - 474 - (326 - 139 * ((ss + 1 )->cutoffCnt > 3 )) * depth * depth)
766766 {
767767 value = qsearch<NonPV>(pos, ss, alpha - 1 , alpha);
768768 if (value < alpha)
@@ -773,21 +773,21 @@ Value Search::Worker::search(
773773 // The depth condition is important for mate finding.
774774 if (!ss->ttPv && depth < 11
775775 && eval - futility_margin (depth, cutNode && !ss->ttHit , improving, opponentWorsening)
776- - (ss - 1 )->statScore / 258
776+ - (ss - 1 )->statScore / 252
777777 >= beta
778778 && eval >= beta && eval < VALUE_TB_WIN_IN_MAX_PLY && (!ttMove || ttCapture))
779779 return beta > VALUE_TB_LOSS_IN_MAX_PLY ? (eval + beta) / 2 : eval;
780780
781781 // Step 9. Null move search with verification search (~35 Elo)
782- if (!PvNode && (ss - 1 )->currentMove != Move::null () && (ss - 1 )->statScore < 16079
783- && eval >= beta && ss->staticEval >= beta - 21 * depth + 324 && !excludedMove
782+ if (!PvNode && (ss - 1 )->currentMove != Move::null () && (ss - 1 )->statScore < 15246
783+ && eval >= beta && ss->staticEval >= beta - 21 * depth + 366 && !excludedMove
784784 && pos.non_pawn_material (us) && ss->ply >= thisThread->nmpMinPly
785785 && beta > VALUE_TB_LOSS_IN_MAX_PLY)
786786 {
787787 assert (eval - beta >= 0 );
788788
789789 // Null move dynamic reduction based on depth and eval
790- Depth R = std::min (int (eval - beta) / 144 , 6 ) + depth / 3 + 5 ;
790+ Depth R = std::min (int (eval - beta) / 152 , 6 ) + depth / 3 + 5 ;
791791
792792 ss->currentMove = Move::null ();
793793 ss->continuationHistory = &thisThread->continuationHistory [0 ][0 ][NO_PIECE][0 ];
@@ -835,7 +835,7 @@ Value Search::Worker::search(
835835 // Step 11. ProbCut (~10 Elo)
836836 // If we have a good enough capture (or queen promotion) and a reduced search returns a value
837837 // much above beta, we can (almost) safely prune the previous move.
838- probCutBeta = beta + 177 - 65 * improving;
838+ probCutBeta = beta + 176 - 65 * improving;
839839 if (
840840 !PvNode && depth > 3
841841 && std::abs (beta) < VALUE_TB_WIN_IN_MAX_PLY
@@ -891,7 +891,7 @@ Value Search::Worker::search(
891891moves_loop: // When in check, search starts here
892892
893893 // Step 12. A small Probcut idea, when we are in check (~4 Elo)
894- probCutBeta = beta + 428 ;
894+ probCutBeta = beta + 440 ;
895895 if (ss->inCheck && !PvNode && ttCapture && (tte->bound () & BOUND_LOWER)
896896 && tte->depth () >= depth - 4 && ttValue >= probCutBeta
897897 && std::abs (ttValue) < VALUE_TB_WIN_IN_MAX_PLY && std::abs (beta) < VALUE_TB_WIN_IN_MAX_PLY)
@@ -975,15 +975,15 @@ Value Search::Worker::search(
975975 // Futility pruning for captures (~2 Elo)
976976 if (!givesCheck && lmrDepth < 7 && !ss->inCheck )
977977 {
978- Value futilityValue = ss->staticEval + 305 + 272 * lmrDepth
978+ Value futilityValue = ss->staticEval + 276 + 256 * lmrDepth
979979 + PieceValue[capturedPiece] + captHist / 7 ;
980980 if (futilityValue <= alpha)
981981 continue ;
982982 }
983983
984984 // SEE based pruning for captures and checks (~11 Elo)
985- int seeHist = std::clamp (captHist / 32 , -185 * depth, 182 * depth);
986- if (!pos.see_ge (move, -176 * depth - seeHist))
985+ int seeHist = std::clamp (captHist / 32 , -177 * depth, 175 * depth);
986+ if (!pos.see_ge (move, -183 * depth - seeHist))
987987 continue ;
988988 }
989989 else
@@ -994,18 +994,18 @@ Value Search::Worker::search(
994994 + thisThread->pawnHistory [pawn_structure_index (pos)][movedPiece][move.to_sq ()];
995995
996996 // Continuation history based pruning (~2 Elo)
997- if (lmrDepth < 6 && history < -4360 * depth)
997+ if (lmrDepth < 6 && history < -4076 * depth)
998998 continue ;
999999
10001000 history += 2 * thisThread->mainHistory [us][move.from_to ()];
10011001
1002- lmrDepth += history / 4507 ;
1002+ lmrDepth += history / 4401 ;
10031003
10041004 Value futilityValue =
1005- ss->staticEval + (bestValue < ss->staticEval - 54 ? 142 : 55 ) + 132 * lmrDepth;
1005+ ss->staticEval + (bestValue < ss->staticEval - 53 ? 151 : 57 ) + 140 * lmrDepth;
10061006
10071007 // Futility pruning: parent node (~13 Elo)
1008- if (!ss->inCheck && lmrDepth < 11 && futilityValue <= alpha)
1008+ if (!ss->inCheck && lmrDepth < 10 && futilityValue <= alpha)
10091009 {
10101010 if (bestValue <= futilityValue && std::abs (bestValue) < VALUE_TB_WIN_IN_MAX_PLY
10111011 && futilityValue < VALUE_TB_WIN_IN_MAX_PLY)
@@ -1016,7 +1016,7 @@ Value Search::Worker::search(
10161016 lmrDepth = std::max (lmrDepth, 0 );
10171017
10181018 // Prune moves with negative SEE (~4 Elo)
1019- if (!pos.see_ge (move, -27 * lmrDepth * lmrDepth))
1019+ if (!pos.see_ge (move, -26 * lmrDepth * lmrDepth))
10201020 continue ;
10211021 }
10221022 }
@@ -1036,11 +1036,11 @@ Value Search::Worker::search(
10361036 // so changing them requires tests at these types of time controls.
10371037 // Recursive singular search is avoided.
10381038 if (!rootNode && move == ttMove && !excludedMove
1039- && depth >= 4 - (thisThread->completedDepth > 33 ) + ss->ttPv
1039+ && depth >= 4 - (thisThread->completedDepth > 35 ) + ss->ttPv
10401040 && std::abs (ttValue) < VALUE_TB_WIN_IN_MAX_PLY && (tte->bound () & BOUND_LOWER)
10411041 && tte->depth () >= depth - 3 )
10421042 {
1043- Value singularBeta = ttValue - (59 + 49 * (ss->ttPv && !PvNode)) * depth / 64 ;
1043+ Value singularBeta = ttValue - (57 + 50 * (ss->ttPv && !PvNode)) * depth / 64 ;
10441044 Depth singularDepth = newDepth / 2 ;
10451045
10461046 ss->excludedMove = move;
@@ -1050,14 +1050,14 @@ Value Search::Worker::search(
10501050
10511051 if (value < singularBeta)
10521052 {
1053- int doubleMargin = 285 * PvNode - 228 * !ttCapture;
1053+ int doubleMargin = 298 * PvNode - 209 * !ttCapture;
10541054 int tripleMargin =
1055- 121 + 238 * PvNode - 259 * !ttCapture + 117 * (ss->ttPv || !ttCapture);
1055+ 117 + 252 * PvNode - 270 * !ttCapture + 111 * (ss->ttPv || !ttCapture);
10561056
10571057 extension = 1 + (value < singularBeta - doubleMargin)
10581058 + (value < singularBeta - tripleMargin);
10591059
1060- depth += ((!PvNode) && (depth < 14 ));
1060+ depth += ((!PvNode) && (depth < 15 ));
10611061 }
10621062
10631063 // Multi-cut pruning
@@ -1092,7 +1092,7 @@ Value Search::Worker::search(
10921092 else if (PvNode && move == ttMove && move.to_sq () == prevSq
10931093 && thisThread->captureHistory [movedPiece][move.to_sq ()]
10941094 [type_of (pos.piece_on (move.to_sq ()))]
1095- > 4041 )
1095+ > 3748 )
10961096 extension = 1 ;
10971097 }
10981098
@@ -1143,10 +1143,10 @@ Value Search::Worker::search(
11431143
11441144 ss->statScore = 2 * thisThread->mainHistory [us][move.from_to ()]
11451145 + (*contHist[0 ])[movedPiece][move.to_sq ()]
1146- + (*contHist[1 ])[movedPiece][move.to_sq ()] - 5313 ;
1146+ + (*contHist[1 ])[movedPiece][move.to_sq ()] - 5266 ;
11471147
11481148 // Decrease/increase reduction for moves with a good/bad history (~8 Elo)
1149- r -= ss->statScore / (16145 - std::min (depth, 15 ) * 102 );
1149+ r -= ss->statScore / (14519 - std::min (depth, 15 ) * 103 );
11501150
11511151 // Step 17. Late moves reduction / extension (LMR, ~117 Elo)
11521152 if (depth >= 2 && moveCount > 1 + rootNode)
@@ -1165,7 +1165,7 @@ Value Search::Worker::search(
11651165 {
11661166 // Adjust full-depth search based on LMR results - if the result
11671167 // was good enough search deeper, if it was bad enough search shallower.
1168- const bool doDeeperSearch = value > (bestValue + 41 + 2 * newDepth); // (~1 Elo)
1168+ const bool doDeeperSearch = value > (bestValue + 40 + 2 * newDepth); // (~1 Elo)
11691169 const bool doShallowerSearch = value < bestValue + newDepth; // (~2 Elo)
11701170
11711171 newDepth += doDeeperSearch - doShallowerSearch;
@@ -1326,9 +1326,9 @@ Value Search::Worker::search(
13261326 // Bonus for prior countermove that caused the fail low
13271327 else if (!priorCapture && prevSq != SQ_NONE)
13281328 {
1329- int bonus = (depth > 4 ) + (depth > 5 ) + (PvNode || cutNode) + ((ss - 1 )->statScore < -14323 )
1330- + ((ss - 1 )->moveCount > 10 ) + (!ss->inCheck && bestValue <= ss->staticEval - 120 )
1331- + (!(ss - 1 )->inCheck && bestValue <= -(ss - 1 )->staticEval - 76 );
1329+ int bonus = (depth > 4 ) + (depth > 5 ) + (PvNode || cutNode) + ((ss - 1 )->statScore < -13241 )
1330+ + ((ss - 1 )->moveCount > 10 ) + (!ss->inCheck && bestValue <= ss->staticEval - 127 )
1331+ + (!(ss - 1 )->inCheck && bestValue <= -(ss - 1 )->staticEval - 74 );
13321332 update_continuation_histories (ss - 1 , pos.piece_on (prevSq), prevSq,
13331333 stat_bonus (depth) * bonus);
13341334 thisThread->mainHistory [~us][((ss - 1 )->currentMove ).from_to ()]
@@ -1494,7 +1494,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
14941494 if (bestValue > alpha)
14951495 alpha = bestValue;
14961496
1497- futilityBase = ss->staticEval + 259 ;
1497+ futilityBase = ss->staticEval + 264 ;
14981498 }
14991499
15001500 const PieceToHistory* contHist[] = {(ss - 1 )->continuationHistory ,
@@ -1566,11 +1566,11 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
15661566 + (*contHist[1 ])[pos.moved_piece (move)][move.to_sq ()]
15671567 + thisThread->pawnHistory [pawn_structure_index (pos)][pos.moved_piece (move)]
15681568 [move.to_sq ()]
1569- <= 4057 )
1569+ <= 4348 )
15701570 continue ;
15711571
15721572 // Do not search moves with bad enough SEE values (~5 Elo)
1573- if (!pos.see_ge (move, -68 ))
1573+ if (!pos.see_ge (move, -63 ))
15741574 continue ;
15751575 }
15761576
@@ -1636,7 +1636,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta,
16361636
16371637Depth Search::Worker::reduction (bool i, Depth d, int mn, int delta) {
16381638 int reductionScale = reductions[d] * reductions[mn];
1639- return (reductionScale + 1284 - delta * 755 / rootDelta) / 1024 + (!i && reductionScale > 1133 );
1639+ return (reductionScale + 1147 - delta * 755 / rootDelta) / 1024 + (!i && reductionScale > 1125 );
16401640}
16411641
16421642// elapsed() returns the time elapsed since the search started. If the
0 commit comments