X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=c0e355b7522b4044a7f4c5d1ab89620abdfd5ed5;hp=98bf24a828e7174e48d4687785b7579b81e3406f;hb=93c9f342ca4f2230021ddbca83a991ff90a6a246;hpb=77eec9f9cb50e742151273da6e4cd2847fe9ec1f diff --git a/src/search.cpp b/src/search.cpp index 98bf24a8..c0e355b7 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -172,6 +172,9 @@ namespace { const bool PruneDefendingMoves = false; const bool PruneBlockingMoves = false; + // Only move margin + const Value OnlyMoveMargin = Value(100); + // Margins for futility pruning in the quiescence search, and at frontier // and near frontier nodes. const Value FutilityMarginQS = Value(0x80); @@ -1132,12 +1135,34 @@ namespace { moveIsCheck = pos.move_is_check(move, ci); captureOrPromotion = pos.move_is_capture_or_promotion(move); - movesSearched[moveCount++] = ss[ply].currentMove = move; + movesSearched[moveCount++] = move; // Decide the new search depth ext = extension(pos, move, true, captureOrPromotion, moveIsCheck, singleReply, mateThreat, &dangerous); + + // Only move extension + if ( moveCount == 1 + && ext < OnePly + && depth >= 8 * OnePly + && tte + && (tte->type() & VALUE_TYPE_LOWER) + && tte->move() != MOVE_NONE + && tte->depth() >= depth - 3 * OnePly) + { + Value ttValue = value_from_tt(tte->value(), ply); + if (abs(ttValue) < VALUE_KNOWN_WIN) + { + Value excValue = search(pos, ss, ttValue - OnlyMoveMargin, depth / 2, ply, false, threadID, tte->move()); + if (excValue < ttValue - OnlyMoveMargin) + ext = OnePly; + } + } + newDepth = depth - OnePly + ext; + // Update current move + ss[ply].currentMove = move; + // Make and search the move pos.do_move(move, st, ci, moveIsCheck); @@ -1412,12 +1437,35 @@ namespace { moveIsCheck = pos.move_is_check(move, ci); captureOrPromotion = pos.move_is_capture_or_promotion(move); - movesSearched[moveCount++] = ss[ply].currentMove = move; + movesSearched[moveCount++] = move; // Decide the new search depth ext = extension(pos, move, false, captureOrPromotion, moveIsCheck, singleReply, mateThreat, &dangerous); + + // Only move extension + if ( forbiddenMove == MOVE_NONE + && moveCount == 1 + && ext < OnePly + && depth >= 8 * OnePly + && tte + && (tte->type() & VALUE_TYPE_LOWER) + && tte->move() != MOVE_NONE + && tte->depth() >= depth - 3 * OnePly) + { + Value ttValue = value_from_tt(tte->value(), ply); + if (abs(ttValue) < VALUE_KNOWN_WIN) + { + Value excValue = search(pos, ss, ttValue - OnlyMoveMargin, depth / 2, ply, false, threadID, tte->move()); + if (excValue < ttValue - OnlyMoveMargin) + ext = OnePly; + } + } + newDepth = depth - OnePly + ext; + // Update current move + ss[ply].currentMove = move; + // Futility pruning if ( useFutilityPruning && !dangerous