From: Joost VandeVondele Date: Mon, 2 Apr 2018 22:13:35 +0000 (+0200) Subject: Simplify Singular Extension condition X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=0cfb653eeca1bc44b9d331498a9ccb3e9b97a9c1 Simplify Singular Extension condition Avoid defining a singly used variable, removes one condition. passed STC: LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 53489 W: 10814 L: 10752 D: 31923 http://tests.stockfishchess.org/tests/view/5ac08a8d0ebc590e9457cd94 Closes https://github.com/official-stockfish/Stockfish/pull/1530 No functional change. --- diff --git a/src/search.cpp b/src/search.cpp index 43193f10..435b7206 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -521,7 +521,7 @@ namespace { Move ttMove, move, excludedMove, bestMove; Depth extension, newDepth; Value bestValue, value, ttValue, eval, maxValue; - bool ttHit, inCheck, givesCheck, singularExtensionNode, improving; + bool ttHit, inCheck, givesCheck, improving; bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact; Piece movedPiece; int moveCount, captureCount, quietCount; @@ -820,13 +820,6 @@ moves_loop: // When in check, search starts from here MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory, contHist, countermove, ss->killers); value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc - singularExtensionNode = !rootNode - && depth >= 8 * ONE_PLY - && ttMove != MOVE_NONE - && ttValue != VALUE_NONE - && !excludedMove // Recursive singular search is not allowed - && (tte->bound() & BOUND_LOWER) - && tte->depth() >= depth - 3 * ONE_PLY; skipQuiets = false; ttCapture = false; pvExact = PvNode && ttHit && tte->bound() == BOUND_EXACT; @@ -866,13 +859,18 @@ moves_loop: // When in check, search starts from here // Step 13. Extensions (~70 Elo) - // Singular extension search (~60 Elo). If all moves but one fail low on a search - // of (alpha-s, beta-s), and just one fails high on (alpha, beta), then - // that move is singular and should be extended. To verify this we do a - // reduced search on on all the other moves but the ttMove and if the + // Singular extension search (~60 Elo). If all moves but one fail low on a + // search of (alpha-s, beta-s), and just one fails high on (alpha, beta), + // then that move is singular and should be extended. To verify this we do + // a reduced search on on all the other moves but the ttMove and if the // result is lower than ttValue minus a margin then we will extend the ttMove. - if ( singularExtensionNode + if ( depth >= 8 * ONE_PLY && move == ttMove + && !rootNode + && !excludedMove // Recursive singular search is not allowed + && ttValue != VALUE_NONE + && (tte->bound() & BOUND_LOWER) + && tte->depth() >= depth - 3 * ONE_PLY && pos.legal(move)) { Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE); diff --git a/src/types.h b/src/types.h index 2fb8fe7b..72c5699f 100644 --- a/src/types.h +++ b/src/types.h @@ -257,10 +257,10 @@ enum Rank : int { }; -/// Score enum stores a middlegame and an endgame value in a single integer -/// (enum). The least significant 16 bits are used to store the endgame value -/// and the upper 16 bits are used to store the middlegame value. Take some -/// care to avoid left-shifting a signed int to avoid undefined behavior. +/// Score enum stores a middlegame and an endgame value in a single integer (enum). +/// The least significant 16 bits are used to store the middlegame value and the +/// upper 16 bits are used to store the endgame value. We have to take care to +/// avoid left-shifting a signed int to avoid undefined behavior. enum Score : int { SCORE_ZERO }; constexpr Score make_score(int mg, int eg) {