mirror of
https://github.com/sockspls/badfish
synced 2025-07-12 03:59:15 +00:00
Replace distanceFromPv with a better logic
This patch removes the recently introduced distanceFromPv logic, and replaces it with following logic: if reduction of moves with low movecount is really negative, we search them deeper than the first move. passed STC: LLR: 2.95 (-2.94,2.94) {-0.20,1.10} Total: 153008 W: 13913 L: 13579 D: 125516 Ptnml(0-2): 547, 10811, 53470, 11113, 563 https://tests.stockfishchess.org/tests/view/6069c9d02b2df919fd5f04d2 passed LTC: LLR: 2.94 (-2.94,2.94) {0.20,0.90} Total: 101920 W: 3964 L: 3699 D: 94257 Ptnml(0-2): 55, 3279, 44019, 3560, 47 https://tests.stockfishchess.org/tests/view/606a99fd2b2df919fd5f0532 Closes https://github.com/official-stockfish/Stockfish/pull/3421 Bench: 4191632
This commit is contained in:
parent
f40913f7f6
commit
3dfda1b28e
2 changed files with 4 additions and 8 deletions
|
@ -618,7 +618,6 @@ namespace {
|
||||||
moveCount = captureCount = quietCount = ss->moveCount = 0;
|
moveCount = captureCount = quietCount = ss->moveCount = 0;
|
||||||
bestValue = -VALUE_INFINITE;
|
bestValue = -VALUE_INFINITE;
|
||||||
maxValue = VALUE_INFINITE;
|
maxValue = VALUE_INFINITE;
|
||||||
ss->distanceFromPv = (PvNode ? 0 : ss->distanceFromPv);
|
|
||||||
|
|
||||||
// Check for the available remaining time
|
// Check for the available remaining time
|
||||||
if (thisThread == Threads.main())
|
if (thisThread == Threads.main())
|
||||||
|
@ -1180,8 +1179,6 @@ moves_loop: // When in check, search starts from here
|
||||||
// Step 15. Make the move
|
// Step 15. Make the move
|
||||||
pos.do_move(move, st, givesCheck);
|
pos.do_move(move, st, givesCheck);
|
||||||
|
|
||||||
(ss+1)->distanceFromPv = ss->distanceFromPv + moveCount - 1;
|
|
||||||
|
|
||||||
// Step 16. Late moves reduction / extension (LMR, ~200 Elo)
|
// Step 16. Late moves reduction / extension (LMR, ~200 Elo)
|
||||||
// We use various heuristics for the sons of a node after the first son has
|
// We use various heuristics for the sons of a node after the first son has
|
||||||
// been searched. In general we would like to reduce them, but there are many
|
// been searched. In general we would like to reduce them, but there are many
|
||||||
|
@ -1280,10 +1277,10 @@ moves_loop: // When in check, search starts from here
|
||||||
r -= ss->statScore / 14790;
|
r -= ss->statScore / 14790;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In general we want to cap the LMR depth search at newDepth. But for nodes
|
// In general we want to cap the LMR depth search at newDepth. But if
|
||||||
// close to the principal variation the cap is at (newDepth + 1), which will
|
// reductions are really negative and movecount is low, we allow this move
|
||||||
// allow these nodes to be searched deeper than the pv (up to 4 plies deeper).
|
// to be searched deeper than the first move.
|
||||||
Depth d = std::clamp(newDepth - r, 1, newDepth + ((ss+1)->distanceFromPv <= 4));
|
Depth d = std::clamp(newDepth - r, 1, newDepth + (r < -1 && moveCount <= 5));
|
||||||
|
|
||||||
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true);
|
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true);
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ struct Stack {
|
||||||
Value staticEval;
|
Value staticEval;
|
||||||
int statScore;
|
int statScore;
|
||||||
int moveCount;
|
int moveCount;
|
||||||
int distanceFromPv;
|
|
||||||
bool inCheck;
|
bool inCheck;
|
||||||
bool ttPv;
|
bool ttPv;
|
||||||
bool ttHit;
|
bool ttHit;
|
||||||
|
|
Loading…
Add table
Reference in a new issue