From: Marco Costalba Date: Fri, 30 Aug 2013 14:40:11 +0000 (+0200) Subject: Fix a bogus assert in allows() X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=3e4dcaa06e7fd555628f1c3a65f4b7967d9708cd;hp=14f47c8ac6a77b9638008a9b61009dd6852be4d6 Fix a bogus assert in allows() Becuase castle is coded as "king captures the rook" the to_sq(move), A1/8 or H1/8 is empty after the move, leading to assert assert(p != NO_PIECE) in color_of(). Teach allows() asserts about castle and fix the crash. Bug reported by Ryan Takker and tracked down by Tom Vijlbrief. No functional change. --- diff --git a/src/search.cpp b/src/search.cpp index c85cdb5d..7b43f64a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -1400,7 +1400,7 @@ moves_loop: // When in check and at SpNode search starts from here assert(is_ok(first)); assert(is_ok(second)); assert(color_of(pos.piece_on(from_sq(second))) == ~pos.side_to_move()); - assert(color_of(pos.piece_on(to_sq(first))) == ~pos.side_to_move()); + assert(type_of(first) == CASTLE || color_of(pos.piece_on(to_sq(first))) == ~pos.side_to_move()); Square m1from = from_sq(first); Square m2from = from_sq(second);