@@ -89,8 +89,10 @@ int risk_tolerance(const Position& pos, Value v) {
89
89
return -345600 * x / (x * x + 3 * y * y);
90
90
};
91
91
92
- int material = 10 * pos.count <ROOK>() + 5 * pos.count <KNIGHT>() + 5 * pos.count <CANNON>()
93
- + 3 * pos.count <BISHOP>() + 2 * pos.count <ADVISOR>() + pos.count <PAWN>();
92
+ int material =
93
+ (640 * pos.count <ROOK>() + 320 * pos.count <KNIGHT>() + 320 * pos.count <CANNON>()
94
+ + 192 * pos.count <BISHOP>() + 128 * pos.count <ADVISOR>() + 64 * pos.count <PAWN>())
95
+ / 64 ;
94
96
95
97
int m = std::clamp (material, 17 , 110 );
96
98
@@ -137,11 +139,11 @@ void update_correction_history(const Position& pos,
137
139
<< bonus * 128 / 128 ;
138
140
}
139
141
140
- // History and stats update bonus, based on depth
141
- int stat_bonus (Depth d) { return std::min (158 * d - 87 , 2168 ); }
142
+ // // History and stats update bonus, based on depth
143
+ // int stat_bonus(Depth d) { return std::min(158 * d - 87, 2168); }
142
144
143
- // History and stats update malus, based on depth
144
- int stat_malus (Depth d) { return std::min (977 * d - 282 , 1524 ); }
145
+ // // History and stats update malus, based on depth
146
+ // int stat_malus(Depth d) { return std::min(977 * d - 282, 1524); }
145
147
146
148
// Add a small random component to draw evaluations to avoid 3-fold blindness
147
149
Value value_draw (size_t nodes) { return VALUE_DRAW - 1 + Value (nodes & 0x2 ); }
@@ -668,12 +670,13 @@ Value Search::Worker::search(
668
670
{
669
671
// Bonus for a quiet ttMove that fails high
670
672
if (!ttCapture)
671
- update_quiet_histories (pos, ss, *this , ttData.move , stat_bonus (depth) * 747 / 1024 );
673
+ update_quiet_histories (pos, ss, *this , ttData.move ,
674
+ std::min (115 * depth - 63 , 1582 ));
672
675
673
676
// Extra penalty for early quiet moves of the previous ply
674
677
if (prevSq != SQ_NONE && (ss - 1 )->moveCount <= 2 && !priorCapture)
675
678
update_continuation_histories (ss - 1 , pos.piece_on (prevSq), prevSq,
676
- -stat_malus ( depth + 1 ) * 1091 / 1024 );
679
+ -std::min ( 1041 * ( depth + 1 ) - 300 , 1624 ) );
677
680
}
678
681
679
682
// Partial workaround for the graph history interaction problem
@@ -1347,7 +1350,7 @@ Value Search::Worker::search(
1347
1350
1348
1351
bonusScale = std::max (bonusScale, 0 );
1349
1352
1350
- const int scaledBonus = stat_bonus ( depth) * bonusScale;
1353
+ const int scaledBonus = std::min ( 158 * depth - 87 , 2168 ) * bonusScale;
1351
1354
1352
1355
update_continuation_histories (ss - 1 , pos.piece_on (prevSq), prevSq,
1353
1356
scaledBonus * 416 / 32768 );
@@ -1366,7 +1369,7 @@ Value Search::Worker::search(
1366
1369
Piece capturedPiece = pos.captured_piece ();
1367
1370
assert (capturedPiece != NO_PIECE);
1368
1371
thisThread->captureHistory [pos.piece_on (prevSq)][prevSq][type_of (capturedPiece)]
1369
- << stat_bonus (depth) * 2 ;
1372
+ << std::min ( 316 * depth - 174 , 4336 ) ;
1370
1373
}
1371
1374
1372
1375
if (PvNode)
@@ -1740,8 +1743,8 @@ void update_all_stats(const Position& pos,
1740
1743
Piece moved_piece = pos.moved_piece (bestMove);
1741
1744
PieceType captured;
1742
1745
1743
- int bonus = stat_bonus ( depth) + 300 * isTTMove;
1744
- int malus = stat_malus ( depth) - 34 * (moveCount - 1 );
1746
+ int bonus = std::min ( 158 * depth - 87 , 2168 ) + 300 * isTTMove;
1747
+ int malus = std::min ( 977 * depth - 282 , 1524 ) - 34 * (moveCount - 1 );
1745
1748
1746
1749
if (!pos.capture (bestMove))
1747
1750
{
0 commit comments