mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Remove white/black_pawn_attacks()
Unuseful syntactic sugar, obfuscates the real code. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
f036239521
commit
2bea93975e
2 changed files with 8 additions and 18 deletions
|
@ -385,8 +385,8 @@ bool Position::square_is_attacked(Square s, Color c) const {
|
|||
|
||||
Bitboard Position::attacks_to(Square s) const {
|
||||
return
|
||||
(black_pawn_attacks(s) & pawns(WHITE)) |
|
||||
(white_pawn_attacks(s) & pawns(BLACK)) |
|
||||
(pawn_attacks(BLACK, s) & pawns(WHITE)) |
|
||||
(pawn_attacks(WHITE, s) & pawns(BLACK)) |
|
||||
(piece_attacks<KNIGHT>(s) & pieces_of_type(KNIGHT)) |
|
||||
(piece_attacks<ROOK>(s) & rooks_and_queens()) |
|
||||
(piece_attacks<BISHOP>(s) & bishops_and_queens()) |
|
||||
|
@ -847,9 +847,9 @@ void Position::do_move(Move m, UndoInfo &u, Bitboard dcCandidates) {
|
|||
}
|
||||
if(piece == PAWN) {
|
||||
if(abs(int(to) - int(from)) == 16) {
|
||||
if((us == WHITE && (white_pawn_attacks(from + DELTA_N) &
|
||||
if((us == WHITE && (pawn_attacks(WHITE, from + DELTA_N) &
|
||||
pawns(BLACK))) ||
|
||||
(us == BLACK && (black_pawn_attacks(from + DELTA_S) &
|
||||
(us == BLACK && (pawn_attacks(BLACK, from + DELTA_S) &
|
||||
pawns(WHITE)))) {
|
||||
epSquare = Square((int(from) + int(to)) / 2);
|
||||
key ^= zobEp[epSquare];
|
||||
|
@ -1632,8 +1632,8 @@ int Position::see(Square from, Square to) const {
|
|||
(bishop_attacks_bb(to, occ) & bishops_and_queens()) |
|
||||
(piece_attacks<KNIGHT>(to) & knights()) |
|
||||
(piece_attacks<KING>(to) & kings()) |
|
||||
(white_pawn_attacks(to) & pawns(BLACK)) |
|
||||
(black_pawn_attacks(to) & pawns(WHITE));
|
||||
(pawn_attacks(WHITE, to) & pawns(BLACK)) |
|
||||
(pawn_attacks(BLACK, to) & pawns(WHITE));
|
||||
attackers &= occ;
|
||||
|
||||
// If the opponent has no attackers, we are finished:
|
||||
|
|
|
@ -194,8 +194,6 @@ public:
|
|||
Bitboard sliding_attacks(Square s, Direction d) const;
|
||||
Bitboard ray_attacks(Square s, SignedDirection d) const;
|
||||
Bitboard pawn_attacks(Color c, Square s) const;
|
||||
Bitboard white_pawn_attacks(Square s) const;
|
||||
Bitboard black_pawn_attacks(Square s) const;
|
||||
|
||||
template<PieceType>
|
||||
Bitboard piece_attacks(Square s) const;
|
||||
|
@ -576,14 +574,6 @@ inline Bitboard Position::pawn_attacks(Color c, Square s) const {
|
|||
return StepAttackBB[pawn_of_color(c)][s];
|
||||
}
|
||||
|
||||
inline Bitboard Position::white_pawn_attacks(Square s) const {
|
||||
return pawn_attacks(WHITE, s);
|
||||
}
|
||||
|
||||
inline Bitboard Position::black_pawn_attacks(Square s) const {
|
||||
return pawn_attacks(BLACK, s);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline Bitboard Position::piece_attacks<KNIGHT>(Square s) const {
|
||||
return StepAttackBB[KNIGHT][s];
|
||||
|
@ -618,11 +608,11 @@ inline bool Position::is_check() const {
|
|||
}
|
||||
|
||||
inline bool Position::white_pawn_attacks_square(Square f, Square t) const {
|
||||
return bit_is_set(white_pawn_attacks(f), t);
|
||||
return bit_is_set(pawn_attacks(WHITE, f), t);
|
||||
}
|
||||
|
||||
inline bool Position::black_pawn_attacks_square(Square f, Square t) const {
|
||||
return bit_is_set(black_pawn_attacks(f), t);
|
||||
return bit_is_set(pawn_attacks(BLACK, f), t);
|
||||
}
|
||||
|
||||
inline bool Position::knight_attacks_square(Square f, Square t) const {
|
||||
|
|
Loading…
Add table
Reference in a new issue