template<bool SkipRepetition> bool is_draw() const;
int startpos_ply_counter() const;
bool opposite_colored_bishops() const;
+ bool both_color_bishops(Color c) const;
bool has_pawn_on_7th(Color c) const;
bool is_chess960() const;
template<PieceType Pt>
inline Bitboard Position::attacks_from(Square s) const {
- return Pt == BISHOP ? bishop_attacks_bb(s, occupied_squares())
- : Pt == ROOK ? rook_attacks_bb(s, occupied_squares())
+ return Pt == BISHOP || Pt == ROOK ? attacks_bb<Pt>(s, occupied_squares())
: Pt == QUEEN ? attacks_from<ROOK>(s) | attacks_from<BISHOP>(s)
- : StepAttacksBB[Pt][s];
+ : StepAttacksBB[Pt][s];
}
template<>
&& opposite_colors(pieceList[WHITE][BISHOP][0], pieceList[BLACK][BISHOP][0]);
}
+inline bool Position::both_color_bishops(Color c) const {
+ // Assumes that there are only two bishops
+ return pieceCount[c][BISHOP] >= 2 &&
+ opposite_colors(pieceList[c][BISHOP][0], pieceList[c][BISHOP][1]);
+}
+
inline bool Position::has_pawn_on_7th(Color c) const {
return pieces(PAWN, c) & rank_bb(relative_rank(c, RANK_7));
}