X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=4ad1eebbf6a6fed3af64640855ed2a715684f0b3;hp=0db8f6c2f9978ebf7935a9d8422f5115f3cfd8c1;hb=d19348221395a5939603bbd1364fda60e4ffd2ee;hpb=87452f3a8c913cb795f04db132ff0f56ee471a62 diff --git a/src/search.cpp b/src/search.cpp index 0db8f6c2..4ad1eebb 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -656,7 +656,7 @@ namespace { ss->staticEval, TT.generation()); } - if (skipEarlyPruning) + if (skipEarlyPruning || !pos.non_pawn_material(pos.side_to_move())) goto moves_loop; // Step 6. Razoring (skipped when in check) @@ -677,15 +677,13 @@ namespace { if ( !rootNode && depth < 7 * ONE_PLY && eval - futility_margin(depth) >= beta - && eval < VALUE_KNOWN_WIN // Do not return unproven wins - && pos.non_pawn_material(pos.side_to_move())) + && eval < VALUE_KNOWN_WIN) // Do not return unproven wins return eval; // Step 8. Null move search with verification search (is omitted in PV nodes) if ( !PvNode && eval >= beta - && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225 - && pos.non_pawn_material(pos.side_to_move())) + && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225) { assert(eval - beta >= 0); @@ -812,7 +810,7 @@ moves_loop: // When in check search starts from here movedPiece = pos.moved_piece(move); givesCheck = type_of(move) == NORMAL && !pos.discovered_check_candidates() - ? pos.check_squares(type_of(pos.piece_on(from_sq(move)))) & to_sq(move) + ? pos.check_squares(type_of(movedPiece)) & to_sq(move) : pos.gives_check(move); moveCountPruning = depth < 16 * ONE_PLY @@ -1115,7 +1113,7 @@ moves_loop: // When in check search starts from here const bool PvNode = NT == PV; - assert(InCheck == !!pos.checkers()); + assert(InCheck == bool(pos.checkers())); assert(alpha >= -VALUE_INFINITE && alpha < beta && beta <= VALUE_INFINITE); assert(PvNode || (alpha == beta - 1)); assert(depth <= DEPTH_ZERO); @@ -1196,7 +1194,7 @@ moves_loop: // When in check search starts from here if (bestValue >= beta) { if (!ttHit) - tte->save(pos.key(), value_to_tt(bestValue, ss->ply), BOUND_LOWER, + tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation()); return bestValue; @@ -1220,7 +1218,7 @@ moves_loop: // When in check search starts from here assert(is_ok(move)); givesCheck = type_of(move) == NORMAL && !pos.discovered_check_candidates() - ? pos.check_squares(type_of(pos.piece_on(from_sq(move)))) & to_sq(move) + ? pos.check_squares(type_of(pos.moved_piece(move))) & to_sq(move) : pos.gives_check(move); moveCount++; @@ -1375,7 +1373,7 @@ moves_loop: // When in check search starts from here CapturePieceToHistory& captureHistory = pos.this_thread()->captureHistory; Piece moved_piece = pos.moved_piece(move); PieceType captured = type_of(pos.piece_on(to_sq(move))); - captureHistory.update(moved_piece,to_sq(move), captured, bonus); + captureHistory.update(moved_piece, to_sq(move), captured, bonus); // Decrease all the other played capture moves for (int i = 0; i < captureCnt; ++i)