Fix a couple of issues in bitbase.cpp
authorMarco Costalba <mcostalba@gmail.com>
Sat, 12 Mar 2011 10:22:02 +0000 (11:22 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 12 Mar 2011 10:22:02 +0000 (11:22 +0100)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/bitbase.cpp

index 3d4fad991189ee8bba77469ca3d0dadb925b9a7c..3426a3182ee703e0919001447a4ed84a241fa0ba 100644 (file)
@@ -162,6 +162,11 @@ namespace {
             && pawnSquare == SQ_A7
             && (blackKingSquare == SQ_C7 || blackKingSquare == SQ_C8))
             return true;
+
+        if (   whiteKingSquare == SQ_H8
+            && pawnSquare == SQ_H7
+            && (blackKingSquare == SQ_F7 || blackKingSquare == SQ_F8))
+            return true;
     }
     return false;
   }
@@ -172,6 +177,7 @@ namespace {
     // white pawn can be promoted without getting captured.
     return   sideToMove == WHITE
           && square_rank(pawnSquare) == RANK_7
+          && whiteKingSquare != pawnSquare + DELTA_N
           && (   square_distance(blackKingSquare, pawnSquare + DELTA_N) > 1
               || bit_is_set(wk_attacks(), pawnSquare + DELTA_N));
   }