mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 16:46:30 +08:00
Clean up API for attack information
Remove undefined functions sliding_attacks() and ray_attacks() and retire square_is_attacked(), use the corresponding definition instead. It is more clear that we are computing full attack info for the given square. Alos fix some obsolete comments in move generation functions. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -183,31 +183,26 @@ public:
|
||||
Square initial_kr_square(Color c) const;
|
||||
Square initial_qr_square(Color c) const;
|
||||
|
||||
// Attack bitboards
|
||||
Bitboard sliding_attacks(Square s, Direction d) const;
|
||||
Bitboard ray_attacks(Square s, SignedDirection d) const;
|
||||
Bitboard pawn_attacks(Color c, Square s) const;
|
||||
|
||||
template<PieceType>
|
||||
Bitboard piece_attacks(Square s) const;
|
||||
|
||||
// Bitboards for pinned pieces and discovered check candidates
|
||||
Bitboard discovered_check_candidates(Color c) const;
|
||||
Bitboard pinned_pieces(Color c, Bitboard& p) const;
|
||||
Bitboard pinned_pieces(Color c) const;
|
||||
|
||||
// Checking pieces
|
||||
// Checking pieces and under check information
|
||||
Bitboard checkers() const;
|
||||
bool is_check() const;
|
||||
|
||||
// Piece lists
|
||||
Square piece_list(Color c, PieceType pt, int index) const;
|
||||
|
||||
// Attack information for a given square
|
||||
bool square_is_attacked(Square s, Color c) const;
|
||||
Bitboard attacks_to(Square s) const;
|
||||
Bitboard attacks_to(Square s, Color c) const;
|
||||
bool is_check() const;
|
||||
bool pawn_attacks_square(Color c, Square f, Square t) const;
|
||||
Bitboard pawn_attacks(Color c, Square s) const;
|
||||
|
||||
template<PieceType>
|
||||
Bitboard piece_attacks(Square s) const;
|
||||
|
||||
template<PieceType>
|
||||
Bitboard piece_attacks_square(Square f, Square t) const; // Dispatch at compile-time
|
||||
@@ -496,11 +491,6 @@ inline Bitboard Position::attacks_to(Square s, Color c) const {
|
||||
return attacks_to(s) & pieces_of_color(c);
|
||||
}
|
||||
|
||||
inline bool Position::square_is_attacked(Square s, Color c) const {
|
||||
|
||||
return attacks_to(s, c) != EmptyBoardBB;
|
||||
}
|
||||
|
||||
inline bool Position::pawn_is_passed(Color c, Square s) const {
|
||||
return !(pieces(PAWN, opposite_color(c)) & passed_pawn_mask(c, s));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user