Skip to content

Commit fc2139f

Browse files
Nonlinear2Disservin
authored andcommitted
se separate parameters for stat values
The code has been refactored to remove the `stat_bonus` and `stat_malus` functions, as the code for each bonus/malus is now different. This allows for future tests to modify these formulas individually. Passed LTC with STC bounds: https://tests.stockfishchess.org/tests/view/67b115dd6c6b9e172ad1592f LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 75756 W: 19393 L: 19044 D: 37319 Ptnml(0-2): 60, 8251, 20913, 8588, 66 Passed LTC with LTC bounds: https://tests.stockfishchess.org/tests/view/67af5f5d6c6b9e172ad15765 LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 108126 W: 27880 L: 27412 D: 52834 Ptnml(0-2): 85, 11786, 29866, 12228, 98 closes official-stockfish#5887 Bench: 2809143
1 parent 45b2b06 commit fc2139f

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/search.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@ void update_correction_history(const Position& pos,
124124
<< bonus * 138 / 128;
125125
}
126126

127-
// History and stats update bonus, based on depth
128-
int stat_bonus(Depth d) { return std::min(158 * d - 98, 1622); }
129-
130-
// History and stats update malus, based on depth
131-
int stat_malus(Depth d) { return std::min(802 * d - 243, 2850); }
132-
133127
// Add a small random component to draw evaluations to avoid 3-fold blindness
134128
Value value_draw(size_t nodes) { return VALUE_DRAW - 1 + Value(nodes & 0x2); }
135129
Value value_to_tt(Value v, int ply);
@@ -678,12 +672,14 @@ Value Search::Worker::search(
678672
{
679673
// Bonus for a quiet ttMove that fails high
680674
if (!ttCapture)
681-
update_quiet_histories(pos, ss, *this, ttData.move, stat_bonus(depth) * 784 / 1024);
675+
update_quiet_histories(pos, ss, *this, ttData.move,
676+
std::min(117600 * depth - 71344, 1244992) / 1024);
682677

683678
// Extra penalty for early quiet moves of the previous ply
684679
if (prevSq != SQ_NONE && (ss - 1)->moveCount <= 3 && !priorCapture)
685680
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq,
686-
-stat_malus(depth + 1) * 1018 / 1024);
681+
-std::min(779788 * (depth + 1) - 271806, 2958308)
682+
/ 1024);
687683
}
688684

689685
// Partial workaround for the graph history interaction problem
@@ -1403,7 +1399,7 @@ Value Search::Worker::search(
14031399

14041400
bonusScale = std::max(bonusScale, 0);
14051401

1406-
const int scaledBonus = stat_bonus(depth) * bonusScale;
1402+
const int scaledBonus = std::min(160 * depth - 106, 1523) * bonusScale;
14071403

14081404
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq,
14091405
scaledBonus * 416 / 32768);
@@ -1422,7 +1418,7 @@ Value Search::Worker::search(
14221418
Piece capturedPiece = pos.captured_piece();
14231419
assert(capturedPiece != NO_PIECE);
14241420
thisThread->captureHistory[pos.piece_on(prevSq)][prevSq][type_of(capturedPiece)]
1425-
<< stat_bonus(depth) * 2;
1421+
<< std::min(330 * depth - 198, 3320);
14261422
}
14271423

14281424
if (PvNode)
@@ -1803,8 +1799,8 @@ void update_all_stats(const Position& pos,
18031799
Piece moved_piece = pos.moved_piece(bestMove);
18041800
PieceType captured;
18051801

1806-
int bonus = stat_bonus(depth) + 298 * isTTMove;
1807-
int malus = stat_malus(depth) - 32 * (moveCount - 1);
1802+
int bonus = std::min(162 * depth - 92, 1587) + 298 * isTTMove;
1803+
int malus = std::min(694 * depth - 230, 2503) - 32 * (moveCount - 1);
18081804

18091805
if (!pos.capture_stage(bestMove))
18101806
{

0 commit comments

Comments
 (0)