X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=0c9f1ee703ef3dd188710826d2c7e2d3713c9354;hp=31aea4668e1dc622fb08bf2a1072f907e8da68e2;hb=e145c0d3e278fb601db49cc16076f10a30b60f19;hpb=03d6a86900044c8b4a512c7e53464fd0a67866fc diff --git a/src/search.cpp b/src/search.cpp index 31aea466..0c9f1ee7 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -916,7 +916,7 @@ namespace { else { if ( newDepth >= 3*OnePly - && i >= MultiPV + LMRPVMoves - 2 // Remove -2 and decrease LMRPVMoves instead ? + && i >= MultiPV + LMRPVMoves && !dangerous && !moveIsCapture && !move_is_promotion(move) @@ -2153,7 +2153,9 @@ namespace { // the second move is assumed to be a move from the current position. bool connected_moves(const Position& pos, Move m1, Move m2) { + Square f1, t1, f2, t2; + Piece p; assert(move_is_ok(m1)); assert(move_is_ok(m2)); @@ -2179,11 +2181,12 @@ namespace { return true; // Case 4: The destination square for m2 is attacked by the moving piece in m1 - if (pos.piece_attacks_square(pos.piece_on(t1), t1, t2)) + p = pos.piece_on(t1); + if (bit_is_set(pos.attacks_from(p, t1), t2)) return true; // Case 5: Discovered check, checking piece is the piece moved in m1 - if ( piece_is_slider(pos.piece_on(t1)) + if ( piece_is_slider(p) && bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), f2) && !bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), t2)) { @@ -2191,19 +2194,19 @@ namespace { Color us = pos.side_to_move(); Square ksq = pos.king_square(us); clear_bit(&occ, f2); - if (pos.type_of_piece_on(t1) == BISHOP) + if (type_of_piece(p) == BISHOP) { if (bit_is_set(bishop_attacks_bb(ksq, occ), t1)) return true; } - else if (pos.type_of_piece_on(t1) == ROOK) + else if (type_of_piece(p) == ROOK) { if (bit_is_set(rook_attacks_bb(ksq, occ), t1)) return true; } else { - assert(pos.type_of_piece_on(t1) == QUEEN); + assert(type_of_piece(p) == QUEEN); if (bit_is_set(queen_attacks_bb(ksq, occ), t1)) return true; } @@ -2439,8 +2442,9 @@ namespace { n = Slowdown; for (i = 0; i < n; i++) { Square s = Square(i&63); - if (count_1s(pos.attacks_to(s)) > 63) - std::cout << "This can't happen, but I put this string here anyway, in order to prevent the compiler from optimizing away the useless computation." << std::endl; + if (count_1s(pos.attackers_to(s)) > 63) + std::cout << "This can't happen, but I put this string here anyway, in order to " + "prevent the compiler from optimizing away the useless computation." << std::endl; } }