X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=438c2d6fe858d85e1c72f1ed37c0ec73b74f48ce;hp=267f5f8f4c64c87fbacc15f9184a16242dbcd394;hb=2ef53ee368683d5aa62b028377b94efe961f18ac;hpb=817ca1820b59152ef511ed8cdabe9116c225a722 diff --git a/src/search.cpp b/src/search.cpp index 267f5f8f..438c2d6f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -592,7 +592,7 @@ namespace { // Never assume anything on values stored in TT if ( (ss->staticEval = eval = tte->eval_value()) == VALUE_NONE ||(ss->evalMargin = tte->eval_margin()) == VALUE_NONE) - eval = ss->staticEval = evaluate(pos, ss->evalMargin); + eval = ss->staticEval = evaluate(pos, ss->evalMargin, &ss->ei); // Can ttValue be used as a better position evaluation? if (ttValue != VALUE_NONE) @@ -602,7 +602,7 @@ namespace { } else { - eval = ss->staticEval = evaluate(pos, ss->evalMargin); + eval = ss->staticEval = evaluate(pos, ss->evalMargin, &ss->ei); TT.store(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval, ss->evalMargin); } @@ -643,10 +643,10 @@ namespace { && !ss->skipNullMove && depth < 4 * ONE_PLY && !inCheck - && eval - futility_margin(depth, (ss-1)->futMc) >= beta + && eval - futility_margin(depth, (ss-1)->futilityMoveCount) >= beta && abs(beta) < VALUE_MATE_IN_MAX_PLY && pos.non_pawn_material(pos.side_to_move())) - return eval - futility_margin(depth, (ss-1)->futMc); + return eval - futility_margin(depth, (ss-1)->futilityMoveCount); // Step 8. Null move search with verification search (is omitted in PV nodes) if ( !PvNode @@ -806,6 +806,7 @@ split_point_start: // At split points actual search starts from here << " currmovenumber " << moveCount + PVIdx << sync_endl; } + ss->futilityMoveCount = 0; ext = DEPTH_ZERO; captureOrPromotion = pos.is_capture_or_promotion(move); givesCheck = pos.move_gives_check(move, ci); @@ -852,8 +853,6 @@ split_point_start: // At split points actual search starts from here // Update current move (this must be done after singular extension search) newDepth = depth - ONE_PLY + ext; - ss->futMc = 0; - // Step 13. Futility pruning (is omitted in PV nodes) if ( !PvNode && !captureOrPromotion @@ -876,8 +875,6 @@ split_point_start: // At split points actual search starts from here // Value based pruning // We illogically ignore reduction condition depth >= 3*ONE_PLY for predicted depth, // but fixing this made program slightly weaker. - ss->futMc = moveCount; - Depth predictedDepth = newDepth - reduction(depth, moveCount); futilityValue = ss->staticEval + ss->evalMargin + futility_margin(predictedDepth, moveCount) + Gain[pos.piece_moved(move)][to_sq(move)]; @@ -904,6 +901,10 @@ split_point_start: // At split points actual search starts from here continue; } + + // We have not pruned the move that will be searched, but remember how + // far in the move list we are to be more aggressive in the child node. + ss->futilityMoveCount = moveCount; } // Check for legality only before to do the move @@ -1174,10 +1175,10 @@ split_point_start: // At split points actual search starts from here // Never assume anything on values stored in TT if ( (ss->staticEval = bestValue = tte->eval_value()) == VALUE_NONE ||(ss->evalMargin = tte->eval_margin()) == VALUE_NONE) - ss->staticEval = bestValue = evaluate(pos, ss->evalMargin); + ss->staticEval = bestValue = evaluate(pos, ss->evalMargin, &ss->ei); } else - ss->staticEval = bestValue = evaluate(pos, ss->evalMargin); + ss->staticEval = bestValue = evaluate(pos, ss->evalMargin, &ss->ei); // Stand pat. Return immediately if static value is at least beta if (bestValue >= beta)