Teach check_blockers to check also non-king pieces

This is a prerequisite for next patch

No functional change.
This commit is contained in:
Stéphane Nicolet
2016-05-21 10:05:19 +02:00
committed by Marco Costalba
parent ab0f4c0353
commit abac509ccb
2 changed files with 15 additions and 16 deletions

View File

@@ -131,6 +131,7 @@ public:
Bitboard attacks_from(Piece pc, Square s) const;
template<PieceType> Bitboard attacks_from(Square s) const;
template<PieceType> Bitboard attacks_from(Square s, Color c) const;
Bitboard slider_blockers(Bitboard target, Bitboard sliders, Square s) const;
// Properties of moves
bool legal(Move m, Bitboard pinned) const;
@@ -186,7 +187,6 @@ private:
void set_state(StateInfo* si) const;
// Other helpers
Bitboard check_blockers(Color c, Color kingColor) const;
void put_piece(Color c, PieceType pt, Square s);
void remove_piece(Color c, PieceType pt, Square s);
void move_piece(Color c, PieceType pt, Square from, Square to);
@@ -311,11 +311,11 @@ inline Bitboard Position::checkers() const {
}
inline Bitboard Position::discovered_check_candidates() const {
return check_blockers(sideToMove, ~sideToMove);
return slider_blockers(pieces(sideToMove), pieces(sideToMove), square<KING>(~sideToMove));
}
inline Bitboard Position::pinned_pieces(Color c) const {
return check_blockers(c, c);
return slider_blockers(pieces(c), pieces(~c), square<KING>(c));
}
inline bool Position::pawn_passed(Color c, Square s) const {