Skip to content

Commit 71e0b53

Browse files
pb00068vondele
authored andcommitted
More bonus for bestMoves on past PV nodes
It looks like it is important to keep past PV (ttPv) nodes as close as possible to current PV nodes. Credits to Mark Tenzer (31m059) & Stefan Geschwentner who first tried ideas on ttPv nodes. STC: https://tests.stockfishchess.org/tests/view/5e2ff5efab2d69d58394fd52 LLR: 2.95 (-2.94,2.94) {-1.00,3.00} Total: 13302 W: 2647 L: 2507 D: 8148 Ptnml(0-2): 237, 1540, 2956, 1632, 260 LTC: https://tests.stockfishchess.org/tests/view/5e2fff38ab2d69d58394fd55 LLR: 2.95 (-2.94,2.94) {0.00,2.00} Total: 15797 W: 2137 L: 1960 D: 11700 Ptnml(0-2): 96, 1443, 4628, 1547, 130 closes #2529 bench: 5545845
1 parent d878bc8 commit 71e0b53

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/search.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ namespace {
158158
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus);
159159
void update_quiet_stats(const Position& pos, Stack* ss, Move move, int bonus);
160160
void update_all_stats(const Position& pos, Stack* ss, Move bestMove, Value bestValue, Value beta, Square prevSq,
161-
Move* quietsSearched, int quietCount, Move* capturesSearched, int captureCount, Depth depth);
161+
Move* quietsSearched, int quietCount, Move* capturesSearched, int captureCount, Depth depth, bool pastPV);
162162

163163
// perft() is our utility to verify move generation. All the leaf nodes up
164164
// to the given depth are generated and counted, and the sum is returned.
@@ -713,7 +713,7 @@ namespace {
713713
if (ttValue >= beta)
714714
{
715715
if (!pos.capture_or_promotion(ttMove))
716-
update_quiet_stats(pos, ss, ttMove, stat_bonus(depth));
716+
update_quiet_stats(pos, ss, ttMove, stat_bonus(depth + (!PvNode && ttPv)));
717717

718718
// Extra penalty for early quiet moves of the previous ply
719719
if ((ss-1)->moveCount <= 2 && !priorCapture)
@@ -722,7 +722,7 @@ namespace {
722722
// Penalty for a quiet ttMove that fails low
723723
else if (!pos.capture_or_promotion(ttMove))
724724
{
725-
int penalty = -stat_bonus(depth);
725+
int penalty = -stat_bonus(depth + (!PvNode && ttPv));
726726
thisThread->mainHistory[us][from_to(ttMove)] << penalty;
727727
update_continuation_histories(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty);
728728
}
@@ -1326,7 +1326,7 @@ namespace {
13261326

13271327
else if (bestMove)
13281328
update_all_stats(pos, ss, bestMove, bestValue, beta, prevSq,
1329-
quietsSearched, quietCount, capturesSearched, captureCount, depth);
1329+
quietsSearched, quietCount, capturesSearched, captureCount, depth, (!PvNode && ttPv));
13301330

13311331
// Bonus for prior countermove that caused the fail low
13321332
else if ( (depth >= 3 || PvNode)
@@ -1602,7 +1602,7 @@ namespace {
16021602
// update_all_stats() updates stats at the end of search() when a bestMove is found
16031603

16041604
void update_all_stats(const Position& pos, Stack* ss, Move bestMove, Value bestValue, Value beta, Square prevSq,
1605-
Move* quietsSearched, int quietCount, Move* capturesSearched, int captureCount, Depth depth) {
1605+
Move* quietsSearched, int quietCount, Move* capturesSearched, int captureCount, Depth depth, bool pastPV) {
16061606

16071607
int bonus1, bonus2;
16081608
Color us = pos.side_to_move();
@@ -1612,8 +1612,8 @@ namespace {
16121612
PieceType captured = type_of(pos.piece_on(to_sq(bestMove)));
16131613

16141614
bonus1 = stat_bonus(depth + 1);
1615-
bonus2 = bestValue > beta + PawnValueMg ? bonus1 // larger bonus
1616-
: stat_bonus(depth); // smaller bonus
1615+
bonus2 = pastPV || bestValue > beta + PawnValueMg ? bonus1 // larger bonus
1616+
: stat_bonus(depth); // smaller bonus
16171617

16181618
if (!pos.capture_or_promotion(bestMove))
16191619
{

0 commit comments

Comments
 (0)