X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsearch.cpp;h=72ab9a1228d36bc58deb8d40e0c92c45fb896f87;hb=0b3ffb54b7c6935e4e178534a4acb112aaa99a06;hp=27365069420871c0dcddd0ba8308dcf63d7e4947;hpb=caef31921900e092616c56193e37201b08baa875;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 27365069..72ab9a12 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -183,7 +183,7 @@ namespace { // Test for a capture that triggers a pawn endgame if ( captureOrPromotion && type_of(pos.piece_on(to_sq(m))) != PAWN - && !is_special(m) + && type_of(m) == NORMAL && ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) - PieceValueMidgame[pos.piece_on(to_sq(m))] == VALUE_ZERO)) return true; @@ -229,7 +229,7 @@ int64_t Search::perft(Position& pos, Depth depth) { StateInfo st; int64_t cnt = 0; - MoveList ml(pos); + MoveList ml(pos); // At the last ply just return the number of moves (leaf nodes) if (depth == ONE_PLY) @@ -661,7 +661,7 @@ namespace { && (ss-1)->eval != VALUE_NONE && ss->eval != VALUE_NONE && !pos.captured_piece_type() - && !is_special(move)) + && type_of(move) == NORMAL) { Square to = to_sq(move); H.update_gain(pos.piece_on(to), to, -(ss-1)->eval - ss->eval); @@ -708,16 +708,16 @@ namespace { ss->currentMove = MOVE_NULL; // Null move dynamic reduction based on depth - int R = 3 + (depth >= 5 * ONE_PLY ? depth / 8 : 0); + Depth R = 3 * ONE_PLY + depth / 4; // Null move dynamic reduction based on value if (refinedValue - PawnValueMidgame > beta) - R++; + R += ONE_PLY; pos.do_null_move(st); (ss+1)->skipNullMove = true; - nullValue = depth-R*ONE_PLY < ONE_PLY ? -qsearch(pos, ss+1, -beta, -alpha, DEPTH_ZERO) - : - search(pos, ss+1, -beta, -alpha, depth-R*ONE_PLY); + nullValue = depth-R < ONE_PLY ? -qsearch(pos, ss+1, -beta, -alpha, DEPTH_ZERO) + : - search(pos, ss+1, -beta, -alpha, depth-R); (ss+1)->skipNullMove = false; pos.do_null_move(st); @@ -732,7 +732,7 @@ namespace { // Do verification search at high depths ss->skipNullMove = true; - Value v = search(pos, ss, alpha, beta, depth-R*ONE_PLY); + Value v = search(pos, ss, alpha, beta, depth-R); ss->skipNullMove = false; if (v >= beta) @@ -902,7 +902,7 @@ split_point_start: // At split points actual search starts from here && !inCheck && !dangerous && move != ttMove - && !is_castle(move) + && type_of(move) != CASTLE && (bestValue > VALUE_MATED_IN_MAX_PLY || bestValue == -VALUE_INFINITE)) { // Move count based pruning @@ -961,7 +961,7 @@ split_point_start: // At split points actual search starts from here && !isPvMove && !captureOrPromotion && !dangerous - && !is_castle(move) + && type_of(move) != CASTLE && ss->killers[0] != move && ss->killers[1] != move) { @@ -1057,7 +1057,6 @@ split_point_start: // At split points actual search starts from here // Step 19. Check for split if ( !SpNode && depth >= Threads.min_split_depth() - && depth - reduction(depth, moveCount) >= Threads.min_split_depth() && bestValue < beta && Threads.available_slave_exists(thisThread) && !Signals.stop @@ -1227,12 +1226,12 @@ split_point_start: // At split points actual search starts from here && !givesCheck && move != ttMove && enoughMaterial - && !is_promotion(move) + && type_of(move) != PROMOTION && !pos.is_passed_pawn_push(move)) { futilityValue = futilityBase + PieceValueEndgame[pos.piece_on(to_sq(move))] - + (is_enpassant(move) ? PawnValueEndgame : VALUE_ZERO); + + (type_of(move) == ENPASSANT ? PawnValueEndgame : VALUE_ZERO); if (futilityValue < beta) { @@ -1260,7 +1259,7 @@ split_point_start: // At split points actual search starts from here if ( !PvNode && (!inCheck || evasionPrunable) && move != ttMove - && !is_promotion(move) + && type_of(move) != PROMOTION && pos.see_sign(move) < 0) continue;