No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
// Remove illegal moves from the list
for (int i = 0; i < n; i++)
- if (!pos.pl_move_is_legal(mlist[i].move, pinned))
+ if (!pos.pl_move_is_legal(mlist[i].move))
mlist[i--].move = mlist[--n].move;
return n;
assert(pos.piece_on(to - pawn_push(us)) == piece_of_color_and_type(them, PAWN));
// The move is pseudo-legal, check if it is also legal
- return pos.pl_move_is_legal(m, pinned);
+ return pos.pl_move_is_legal(m);
}
// Castling moves
return false;
}
// The move is pseudo-legal, check if it is also legal
- return pos.pl_move_is_legal(m, pinned);
+ return pos.pl_move_is_legal(m);
}
// Luckly we can handle all the other pieces in one go
return ( pos.piece_attacks_square(pos.piece_on(from), from, to)
- && pos.pl_move_is_legal(m, pinned)
+ && pos.pl_move_is_legal(m)
&& !move_promotion(m));
}
moves[bestIndex] = moves[movesPicked++];
if ( move != ttMove
&& move != mateKiller
- && pos.pl_move_is_legal(move, pinned))
+ && pos.pl_move_is_legal(move))
return move;
}
break;
moves[bestIndex] = moves[movesPicked++];
if ( move != ttMove
&& move != mateKiller
- && pos.pl_move_is_legal(move, pinned))
+ && pos.pl_move_is_legal(move))
return move;
}
break;
move = badCaptures[movesPicked++].move;
if ( move != ttMove
&& move != mateKiller
- && pos.pl_move_is_legal(move, pinned))
+ && pos.pl_move_is_legal(move))
return move;
}
break;
moves[bestIndex] = moves[movesPicked++];
// Remember to change the line below if we decide to hash the qsearch!
// Maybe also postpone the legality check until after futility pruning?
- if (/* move != ttMove && */ pos.pl_move_is_legal(move, pinned))
+ if (/* move != ttMove && */ pos.pl_move_is_legal(move))
return move;
}
break;
{
move = moves[movesPicked++].move;
// Remember to change the line below if we decide to hash the qsearch!
- if (/* move != ttMove && */ pos.pl_move_is_legal(move, pinned))
+ if (/* move != ttMove && */ pos.pl_move_is_legal(move))
return move;
}
break;
}
-/// 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.
// 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)));
}
// Properties of moves
bool pl_move_is_legal(Move m) const;
- bool pl_move_is_legal(Move m, Bitboard pinned) const;
bool move_is_check(Move m) const;
bool move_is_check(Move m, Bitboard dcCandidates) const;
bool move_is_capture(Move m) const;