]> git.sesse.net Git - stockfish/commitdiff
Bug fix for discovered checks in connected_moves().
authorTord Romstad <tord@glaurungchess.com>
Wed, 2 Sep 2009 07:58:15 +0000 (09:58 +0200)
committerTord Romstad <tord@glaurungchess.com>
Wed, 2 Sep 2009 07:58:15 +0000 (09:58 +0200)
Because of a hard-to-spot single-character bug in connected_moves(),
the discovered check code had no effect whatsoever. The condition
in the if (...) statement at the beginning of the code would always
return false.

Thanks to Edsel Apostol for pointing out this bug!

src/search.cpp

index 806a7fc4ce7596019cd3859dcad18412db5a2a0a..31aea4668e1dc622fb08bf2a1072f907e8da68e2 100644 (file)
@@ -2185,7 +2185,7 @@ namespace {
     // Case 5: Discovered check, checking piece is the piece moved in m1
     if (   piece_is_slider(pos.piece_on(t1))
         && bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), f2)
     // Case 5: Discovered check, checking piece is the piece moved in m1
     if (   piece_is_slider(pos.piece_on(t1))
         && bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), f2)
-        && !bit_is_set(squares_between(t2, pos.king_square(pos.side_to_move())), t2))
+        && !bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), t2))
     {
         Bitboard occ = pos.occupied_squares();
         Color us = pos.side_to_move();
     {
         Bitboard occ = pos.occupied_squares();
         Color us = pos.side_to_move();