mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
MCP more after a bad singular search
The idea is, that if we have the information that the singular search failed low and therefore produced an upperbound score, we can use the score from singularsearch as approximate upperbound as to what bestValue our non ttMoves will produce. If this value is well below alpha, we assume that all non-ttMoves will score below alpha and therfore can skip more moves. This patch also sets up variables for future patches wanting to use teh singular search result outside of singular extensions, in singularBound and singularValue, meaning further patches using this search result to affect various pruning techniques can be tried. Passed STC: https://tests.stockfishchess.org/tests/view/6658d13e6b0e318cefa90120 LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 85632 W: 22112 L: 21725 D: 41795 Ptnml(0-2): 243, 10010, 21947, 10349, 267 Passed LTC: https://tests.stockfishchess.org/tests/view/6658dd356b0e318cefa9016a LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 243978 W: 62014 L: 61272 D: 120692 Ptnml(0-2): 128, 26598, 67791, 27348, 124 closes https://github.com/official-stockfish/Stockfish/pull/5325 bench 1397172
This commit is contained in:
parent
0ef809ac71
commit
b34a690cd4
1 changed files with 9 additions and 3 deletions
|
@ -550,11 +550,12 @@ Value Search::Worker::search(
|
||||||
Key posKey;
|
Key posKey;
|
||||||
Move ttMove, move, excludedMove, bestMove;
|
Move ttMove, move, excludedMove, bestMove;
|
||||||
Depth extension, newDepth;
|
Depth extension, newDepth;
|
||||||
Value bestValue, value, ttValue, eval, maxValue, probCutBeta;
|
Value bestValue, value, ttValue, eval, maxValue, probCutBeta, singularValue;
|
||||||
bool givesCheck, improving, priorCapture, opponentWorsening;
|
bool givesCheck, improving, priorCapture, opponentWorsening;
|
||||||
bool capture, moveCountPruning, ttCapture;
|
bool capture, moveCountPruning, ttCapture;
|
||||||
Piece movedPiece;
|
Piece movedPiece;
|
||||||
int moveCount, captureCount, quietCount;
|
int moveCount, captureCount, quietCount;
|
||||||
|
Bound singularBound;
|
||||||
|
|
||||||
// Step 1. Initialize node
|
// Step 1. Initialize node
|
||||||
Worker* thisThread = this;
|
Worker* thisThread = this;
|
||||||
|
@ -923,6 +924,8 @@ moves_loop: // When in check, search starts here
|
||||||
|
|
||||||
value = bestValue;
|
value = bestValue;
|
||||||
moveCountPruning = false;
|
moveCountPruning = false;
|
||||||
|
singularValue = VALUE_INFINITE;
|
||||||
|
singularBound = BOUND_NONE;
|
||||||
|
|
||||||
// Step 13. Loop through all pseudo-legal moves until no moves remain
|
// Step 13. Loop through all pseudo-legal moves until no moves remain
|
||||||
// or a beta cutoff occurs.
|
// or a beta cutoff occurs.
|
||||||
|
@ -972,7 +975,9 @@ moves_loop: // When in check, search starts here
|
||||||
if (!rootNode && pos.non_pawn_material(us) && bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
|
if (!rootNode && pos.non_pawn_material(us) && bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
|
||||||
{
|
{
|
||||||
// Skip quiet moves if movecount exceeds our FutilityMoveCount threshold (~8 Elo)
|
// Skip quiet moves if movecount exceeds our FutilityMoveCount threshold (~8 Elo)
|
||||||
moveCountPruning = moveCount >= futility_move_count(improving, depth);
|
moveCountPruning =
|
||||||
|
moveCount >= futility_move_count(improving, depth)
|
||||||
|
- (singularBound == BOUND_UPPER && singularValue < alpha - 50);
|
||||||
|
|
||||||
// Reduced depth of the next LMR search
|
// Reduced depth of the next LMR search
|
||||||
int lmrDepth = newDepth - r;
|
int lmrDepth = newDepth - r;
|
||||||
|
@ -1058,8 +1063,9 @@ moves_loop: // When in check, search starts here
|
||||||
Depth singularDepth = newDepth / 2;
|
Depth singularDepth = newDepth / 2;
|
||||||
|
|
||||||
ss->excludedMove = move;
|
ss->excludedMove = move;
|
||||||
value =
|
value = singularValue =
|
||||||
search<NonPV>(pos, ss, singularBeta - 1, singularBeta, singularDepth, cutNode);
|
search<NonPV>(pos, ss, singularBeta - 1, singularBeta, singularDepth, cutNode);
|
||||||
|
singularBound = singularValue >= singularBeta ? BOUND_LOWER : BOUND_UPPER;
|
||||||
ss->excludedMove = Move::none();
|
ss->excludedMove = Move::none();
|
||||||
|
|
||||||
if (value < singularBeta)
|
if (value < singularBeta)
|
||||||
|
|
Loading…
Add table
Reference in a new issue