1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00

Limit double extensions

Double extensions can lead to search explosions, for specific positions.
Currently, however, these double extensions are worth about 10Elo and cannot
be removed. This patch instead limits the number of double extensions given
to a maximum of 3.

This fixes https://github.com/official-stockfish/Stockfish/issues/3532
where the following testcase was shown to be problematic:

```
uci
setoption name Hash value 4
setoption name Contempt value 0
ucinewgame
position fen 8/Pk6/8/1p6/8/P1K5/8/6B1 w - - 37 130
go depth 20
```

passed STC:
https://tests.stockfishchess.org/tests/view/60c13161457376eb8bcaaa0f
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 73256 W: 6114 L: 6062 D: 61080
Ptnml(0-2): 222, 4912, 26306, 4968, 220

passed LTC:
https://tests.stockfishchess.org/tests/view/60c196fb457376eb8bcaaa6b
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 166440 W: 5559 L: 5594 D: 155287
Ptnml(0-2): 106, 4921, 73197, 4894, 102

closes https://github.com/official-stockfish/Stockfish/pull/3544

Bench: 5067605
This commit is contained in:
Joost VandeVondele 2021-06-09 23:23:13 +02:00 committed by Stéphane Nicolet
parent 785b708097
commit 559942d64d
2 changed files with 11 additions and 4 deletions

View file

@ -610,10 +610,11 @@ namespace {
assert(0 <= ss->ply && ss->ply < MAX_PLY);
(ss+1)->ttPv = false;
(ss+1)->ttPv = false;
(ss+1)->excludedMove = bestMove = MOVE_NONE;
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
Square prevSq = to_sq((ss-1)->currentMove);
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
ss->doubleExtensions = (ss-1)->doubleExtensions;
Square prevSq = to_sq((ss-1)->currentMove);
// Initialize statScore to zero for the grandchildren of the current position.
// So statScore is shared between all grandchildren and only the first grandchild
@ -1074,7 +1075,11 @@ moves_loop: // When in check, search starts from here
{
extension = 1;
singularQuietLMR = !ttCapture;
if (!PvNode && value < singularBeta - 93)
// Avoid search explosion by limiting the number of double extensions to at most 3
if ( !PvNode
&& value < singularBeta - 93
&& ss->doubleExtensions < 3)
extension = 2;
}
@ -1105,6 +1110,7 @@ moves_loop: // When in check, search starts from here
// Add extension to new depth
newDepth += extension;
ss->doubleExtensions = (ss-1)->doubleExtensions + (extension == 2);
// Speculative prefetch as early as possible
prefetch(TT.first_entry(pos.key_after(move)));

View file

@ -52,6 +52,7 @@ struct Stack {
bool inCheck;
bool ttPv;
bool ttHit;
int doubleExtensions;
};