Skip to content

Commit 8fec883

Browse files
locutus2snicolet
authored andcommitted
Tweak Late Move Reduction at root
Maintain best move counter at the root and allow there only moves which has a counter of zero for Late Move Reduction. For compensation only the first three moves are excluded from Late Move Reduction per default instead the first four moves. What we can further do: - here we use a simple counting scheme but perhaps some aging to fade out early iterations could be helpful - use the best move counter also at inner nodes for LMR and/or pruning STC: LLR: 2.95 (-2.94,2.94) [0.50,4.50] Total: 17414 W: 3984 L: 3733 D: 9697 http://tests.stockfishchess.org/tests/view/5d6234bb0ebc5939d09f2aa2 LTC: LLR: 2.96 (-2.94,2.94) [0.00,3.50] Total: 38058 W: 6448 L: 6166 D: 25444 http://tests.stockfishchess.org/tests/view/5d62681a0ebc5939d09f2f27 Closes #2282 Bench: 3568210
1 parent 0e295fe commit 8fec883

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/search.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,10 @@ void Thread::search() {
472472
++failedHighCnt;
473473
}
474474
else
475+
{
476+
++rootMoves[pvIdx].bestMoveCount;
475477
break;
478+
}
476479

477480
delta += delta / 4 + 5;
478481

@@ -1072,7 +1075,8 @@ namespace {
10721075
// Step 16. Reduced depth search (LMR). If the move fails high it will be
10731076
// re-searched at full depth.
10741077
if ( depth >= 3 * ONE_PLY
1075-
&& moveCount > 1 + 3 * rootNode
1078+
&& moveCount > 1 + 2 * rootNode
1079+
&& (!rootNode || thisThread->best_move_count(move) == 0)
10761080
&& ( !captureOrPromotion
10771081
|| moveCountPruning
10781082
|| ss->staticEval + PieceValue[EG][pos.captured_piece()] <= alpha

src/search.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ struct RootMove {
7070
Value previousScore = -VALUE_INFINITE;
7171
int selDepth = 0;
7272
int tbRank = 0;
73+
int bestMoveCount = 0;
7374
Value tbScore;
7475
std::vector<Move> pv;
7576
};

src/thread.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ Thread::~Thread() {
5252
stdThread.join();
5353
}
5454

55+
/// Thread::bestMoveCount(Move move) return best move counter for the given root move
56+
57+
int Thread::best_move_count(Move move) {
58+
59+
auto rm = std::find(rootMoves.begin() + pvIdx,
60+
rootMoves.begin() + pvLast, move);
61+
62+
return rm != rootMoves.begin() + pvLast ? rm->bestMoveCount : 0;
63+
}
5564

5665
/// Thread::clear() reset histories, usually before a new game
5766

src/thread.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Thread {
5656
void idle_loop();
5757
void start_searching();
5858
void wait_for_search_finished();
59+
int best_move_count(Move move);
5960

6061
Pawns::Table pawnsTable;
6162
Material::Table materialTable;

0 commit comments

Comments
 (0)