X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=e246512e985bbccff13c91c307454f680dd24356;hp=cff8e768a73693ec3ec29046165602aac7fd404c;hb=6e2371a86bd987487d836482cd9bbe4ceaac2ef7;hpb=a24da071f0d6128c633febab7df55f14475217c3 diff --git a/src/search.cpp b/src/search.cpp index cff8e768..e246512e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -293,7 +293,6 @@ namespace { Stack ss[MAX_PLY_PLUS_2]; int depth, prevBestMoveChanges; Value bestValue, alpha, beta, delta; - bool triedEasyMove = false; memset(ss, 0, 4 * sizeof(Stack)); depth = BestMoveChanges = 0; @@ -440,12 +439,11 @@ namespace { // Stop search early if one move seems to be much better than others if ( depth >= 12 && !stop - && !triedEasyMove && PVSize == 1 + && bestValue > VALUE_MATED_IN_MAX_PLY && ( RootMoves.size() == 1 || Time::now() - SearchTime > (TimeMgr.available_time() * 20) / 100)) { - triedEasyMove = true; Value rBeta = bestValue - 2 * PawnValueMg; (ss+1)->excludedMove = RootMoves[0].pv[0]; (ss+1)->skipNullMove = true; @@ -748,7 +746,7 @@ namespace { && ttMove == MOVE_NONE && (PvNode || (!inCheck && ss->staticEval + Value(256) >= beta))) { - Depth d = (PvNode ? depth - 2 * ONE_PLY : depth / 2); + Depth d = depth - 2 * ONE_PLY - (PvNode ? DEPTH_ZERO : depth / 4); ss->skipNullMove = true; search(pos, ss, alpha, beta, d); @@ -859,7 +857,8 @@ split_point_start: // At split points actual search starts from here && !captureOrPromotion && !inCheck && !dangerous - && move != ttMove) + && move != ttMove + && bestValue > VALUE_MATED_IN_MAX_PLY) { // Move count based pruning if ( depth < 16 * ONE_PLY @@ -877,18 +876,23 @@ split_point_start: // At split points actual search starts from here // but fixing this made program slightly weaker. Depth predictedDepth = newDepth - reduction(depth, moveCount); futilityValue = ss->staticEval + ss->evalMargin + futility_margin(predictedDepth, moveCount) - + Gain[pos.piece_moved(move)][to_sq(move)]; + + 2 * Gain[pos.piece_moved(move)][to_sq(move)]; if (futilityValue < beta) { + bestValue = std::max(bestValue, futilityValue); + if (SpNode) + { splitPoint->mutex.lock(); - + if (bestValue > splitPoint->bestValue) + splitPoint->bestValue = bestValue; + } continue; } // Prune moves with negative SEE at low depths - if ( predictedDepth < 3 * ONE_PLY + if ( predictedDepth < 4 * ONE_PLY && pos.see_sign(move) < 0) { if (SpNode) @@ -1128,6 +1132,12 @@ split_point_start: // At split points actual search starts from here if (pos.is_draw() || ss->ply > MAX_PLY) return DrawValue[pos.side_to_move()]; + // Decide whether or not to include checks, this fixes also the type of + // TT entry depth that we are going to use. Note that in qsearch we use + // only two types of depth in TT: DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS. + ttDepth = InCheck || depth >= DEPTH_QS_CHECKS ? DEPTH_QS_CHECKS + : DEPTH_QS_NO_CHECKS; + // Transposition table lookup. At PV nodes, we don't use the TT for // pruning, but only for move ordering. posKey = pos.key(); @@ -1135,11 +1145,6 @@ split_point_start: // At split points actual search starts from here ttMove = tte ? tte->move() : MOVE_NONE; ttValue = tte ? value_from_tt(tte->value(),ss->ply) : VALUE_NONE; - // Decide whether or not to include checks, this fixes also the type of - // TT entry depth that we are going to use. Note that in qsearch we use - // only two types of depth in TT: DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS. - ttDepth = InCheck || depth >= DEPTH_QS_CHECKS ? DEPTH_QS_CHECKS - : DEPTH_QS_NO_CHECKS; if ( tte && tte->depth() >= ttDepth && ttValue != VALUE_NONE // Only in case of TT access race