mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Do not pass pinned argument in Position::pl_move_is_legal()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
0a0ea36e25
commit
734941672e
4 changed files with 12 additions and 23 deletions
|
@ -360,7 +360,7 @@ int generate_legal_moves(const Position& pos, MoveStack* mlist) {
|
|||
|
||||
// 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;
|
||||
|
@ -405,7 +405,7 @@ bool move_is_legal(const Position& pos, const Move m) {
|
|||
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
|
||||
|
@ -537,12 +537,12 @@ bool move_is_legal(const Position& pos, const Move m) {
|
|||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ Move MovePicker::pick_move_from_list() {
|
|||
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;
|
||||
|
@ -414,7 +414,7 @@ Move MovePicker::pick_move_from_list() {
|
|||
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;
|
||||
|
@ -442,7 +442,7 @@ Move MovePicker::pick_move_from_list() {
|
|||
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;
|
||||
|
@ -457,7 +457,7 @@ Move MovePicker::pick_move_from_list() {
|
|||
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;
|
||||
|
@ -471,7 +471,7 @@ Move MovePicker::pick_move_from_list() {
|
|||
{
|
||||
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;
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -220,7 +220,6 @@ public:
|
|||
|
||||
// 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;
|
||||
|
|
Loading…
Add table
Reference in a new issue