// Piece lists
Square piece_list(Color c, PieceType pt, int index) const;
- // Attack information for a given square
- Bitboard attacks_to(Square s) const;
- Bitboard attacks_to(Square s, Color c) 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
-
- bool piece_attacks_square(Piece p, Square f, Square t) const; // Dispatch at run-time
+ // Attack information to a given square
+ Bitboard attackers_to(Square s) const;
+ Bitboard attackers_to(Square s, Color c) const;
+ Bitboard piece_attacks(Piece p, Square s) const;
+ Bitboard pawn_attacks(Square s, Color c) const;
+ template<PieceType> Bitboard piece_attacks(Square s) const;
// Properties of moves
bool pl_move_is_legal(Move m) const;
// Position consistency check, for debugging
bool is_ok(int* failedStep = NULL) const;
- // Static member functions:
+ // Static member functions
static void init_zobrist();
static void init_piece_square_tables();
return relative_square(c, make_square(initialQRFile, RANK_1));
}
-inline Bitboard Position::pawn_attacks(Color c, Square s) const {
+inline Bitboard Position::pawn_attacks(Square s, Color c) const {
return StepAttackBB[piece_of_color_and_type(c, PAWN)][s];
}
return st->checkersBB != EmptyBoardBB;
}
-inline bool Position::pawn_attacks_square(Color c, Square f, Square t) const {
- return bit_is_set(pawn_attacks(c, f), t);
-}
-
-template<PieceType Piece>
-inline Bitboard Position::piece_attacks_square(Square f, Square t) const {
- return bit_is_set(piece_attacks<Piece>(f), t);
-}
-
-inline Bitboard Position::attacks_to(Square s, Color c) const {
+inline Bitboard Position::attackers_to(Square s, Color c) const {
- return attacks_to(s) & pieces_of_color(c);
+ return attackers_to(s) & pieces_of_color(c);
}
inline bool Position::pawn_is_passed(Color c, Square s) const {