X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=06cc9b60fc97155cf6687422ad5d2b8b2de1eb5b;hp=39ed624c9ecc2408234b63c8518c843d3610fe77;hb=24cc3a97a480afdd5587ab9b2d75c1426acc3133;hpb=c81010a8780d998d0d9a8bd28fd83402736f563b diff --git a/src/search.cpp b/src/search.cpp index 39ed624c..06cc9b60 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1540,14 +1540,10 @@ namespace { // Use the cached evaluation score if possible assert(ei.futilityMargin == Value(0)); - staticValue = tte->value(); + staticValue = tte->value() + 7; } else - { - staticValue = evaluate(pos, ei, threadID); - if (!value_is_mate(staticValue + Value(ply))) - staticValue += Value(ply); - } + staticValue = evaluate(pos, ei, threadID) + 7; if (ply == PLY_MAX - 1) return evaluate(pos, ei, threadID); @@ -2157,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)); @@ -2183,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)) { @@ -2195,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; } @@ -2443,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; } }