X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=3bb8fef931c00924a9aa52cf3823fdecda4a73f6;hp=a999b4c6f0e5ee5a67981184e8bd2e89cf52cb90;hb=734941672ee239636d4327525243c39261a9b171;hpb=0a0ea36e25b2f6fff8859e02027c5842edeccc03 diff --git a/src/position.cpp b/src/position.cpp index a999b4c6..3bb8fef9 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -478,22 +478,12 @@ void Position::find_checkers() { } -/// Position::pl_move_is_legal() tests whether a pseudo-legal move is legal. -/// There are two versions of this function: One which takes only a -/// move as input, and one which takes a move and a bitboard of pinned -/// pieces. The latter function is faster, and should always be preferred -/// when a pinned piece bitboard has already been computed. +/// Position::pl_move_is_legal() tests whether a pseudo-legal move is legal -bool Position::pl_move_is_legal(Move m) const { - - return pl_move_is_legal(m, pinned_pieces(side_to_move())); -} - -bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { +bool Position::pl_move_is_legal(Move m) const { assert(is_ok()); assert(move_is_ok(m)); - assert(pinned == pinned_pieces(side_to_move())); // If we're in check, all pseudo-legal moves are legal, because our // check evasion generator only generates true legal moves. @@ -541,7 +531,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { // A non-king move is legal if and only if it is not pinned or it // is moving along the ray towards or away from the king. - return ( !bit_is_set(pinned, from) + return ( !bit_is_set(pinned_pieces(us), from) || (direction_between_squares(from, ksq) == direction_between_squares(move_to(m), ksq))); }