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

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.
This commit is contained in:
Joost VandeVondele 2018-04-03 00:13:35 +02:00 committed by Stéphane Nicolet
parent e408fd7b10
commit 0cfb653eec
2 changed files with 15 additions and 17 deletions

View file

@ -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);

View file

@ -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) {