X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=097faf90f7c2fc4d15f5845335c306fa792ae99f;hp=3e6e38bd1273e4a94e67c39403ffb5448d697610;hb=41641e3b1eea0038ab6984766d2b3bca869be7fa;hpb=e5c3effdb1fee10a694e493773e62f433e642406 diff --git a/src/search.cpp b/src/search.cpp index 3e6e38bd..097faf90 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -154,10 +154,10 @@ void Search::init() { /// Search::perft() is our utility to verify move generation. All the leaf nodes /// up to the given depth are generated and counted and the sum returned. -static size_t perft(Position& pos, Depth depth) { +static uint64_t perft(Position& pos, Depth depth) { StateInfo st; - size_t cnt = 0; + uint64_t cnt = 0; CheckInfo ci(pos); const bool leaf = depth == 2 * ONE_PLY; @@ -170,7 +170,7 @@ static size_t perft(Position& pos, Depth depth) { return cnt; } -size_t Search::perft(Position& pos, Depth depth) { +uint64_t Search::perft(Position& pos, Depth depth) { return depth > ONE_PLY ? ::perft(pos, depth) : MoveList(pos).size(); } @@ -595,7 +595,7 @@ namespace { // Step 6. Razoring (skipped when in check) if ( !PvNode && depth < 4 * ONE_PLY - && eval + razor_margin(depth) < beta + && eval + razor_margin(depth) <= alpha && ttMove == MOVE_NONE && abs(beta) < VALUE_MATE_IN_MAX_PLY && !pos.pawn_on_7th(pos.side_to_move())) @@ -640,24 +640,8 @@ namespace { (ss+1)->skipNullMove = false; pos.undo_null_move(); - if (nullValue >= beta) - { - // Do not return unproven mate scores - if (nullValue >= VALUE_MATE_IN_MAX_PLY) - nullValue = beta; - - if (depth < 12 * ONE_PLY) - return nullValue; - - // Do verification search at high depths - ss->skipNullMove = true; - Value v = depth-R < ONE_PLY ? qsearch(pos, ss, beta-1, beta, DEPTH_ZERO) - : search(pos, ss, beta-1, beta, depth-R, false); - ss->skipNullMove = false; - - if (v >= beta) - return nullValue; - } + if (nullValue >= beta) // Do not return unproven mate scores + return nullValue >= VALUE_MATE_IN_MAX_PLY ? beta : nullValue; } // Step 9. ProbCut (skipped when in check) @@ -770,7 +754,11 @@ moves_loop: // When in check and at SpNode search starts from here ext = DEPTH_ZERO; captureOrPromotion = pos.capture_or_promotion(move); - givesCheck = pos.gives_check(move, ci); + + givesCheck = type_of(move) == NORMAL && !ci.dcCandidates + ? ci.checkSq[type_of(pos.piece_on(from_sq(move)))] & to_sq(move) + : pos.gives_check(move, ci); + dangerous = givesCheck || type_of(move) != NORMAL || pos.advanced_pawn_push(move); @@ -1150,7 +1138,9 @@ moves_loop: // When in check and at SpNode search starts from here { assert(is_ok(move)); - givesCheck = pos.gives_check(move, ci); + givesCheck = type_of(move) == NORMAL && !ci.dcCandidates + ? ci.checkSq[type_of(pos.piece_on(from_sq(move)))] & to_sq(move) + : pos.gives_check(move, ci); // Futility pruning if ( !PvNode