]> git.sesse.net Git - stockfish/commitdiff
Fix a condition in connected_moves()
authorMarco Costalba <mcostalba@gmail.com>
Fri, 2 Nov 2012 16:04:51 +0000 (17:04 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 2 Nov 2012 16:18:38 +0000 (17:18 +0100)
When checking if the moving piece p1 in a previous
move m1 defends the destination square of a move m2
we have to use the occupancy with the from square of
m2 removed so to take in account the case in which
f2 will block an x-ray attack from p1.

For instance in this position:
r2k3r/p1pp1pb1/qn3np1/1N2P3/1p3P2/2B5/PPP3QP/R3K2R b KQ - 1 9

The move eXf6 is connected to the previous move Bc3 that
defends the destination square f6.

With this patch we have about 10% more moves detected as
'connected'. Anyhow the absolute number is very low, about
4000 more moves out of 6M nodes searched.

Another issue spotted by Hongzhi "Hawk Eye" Cheng ;-)

new bench: 5757373

src/search.cpp

index 76cc8e8d37d1caefdf0995955d6035e058932349..8dc1f85d9e51a30194f48a3c96d2170aa467259a 100644 (file)
@@ -1391,7 +1391,7 @@ split_point_start: // At split points actual search starts from here
 
     // Case 4: The destination square for m2 is defended by the moving piece in m1
     p1 = pos.piece_on(t1);
 
     // Case 4: The destination square for m2 is defended by the moving piece in m1
     p1 = pos.piece_on(t1);
-    if (pos.attacks_from(p1, t1) & t2)
+    if (pos.attacks_from(p1, t1, pos.pieces() ^ f2) & t2)
         return true;
 
     // Case 5: Discovered check, checking piece is the piece moved in m1
         return true;
 
     // Case 5: Discovered check, checking piece is the piece moved in m1