Square epSquare;
// Not copied when making a move (will be recomputed anyhow)
+ int repetition;
Key key;
Bitboard checkersBB;
Piece capturedPiece;
template<PieceType Pt> int count() const;
template<PieceType Pt> const Square* squares(Color c) const;
template<PieceType Pt> Square square(Color c) const;
- int semiopen_file(Color c, File f) const;
+ bool is_on_semiopen_file(Color c, Square s) const;
// Castling
int castling_rights(Color c) const;
Bitboard checkers() const;
Bitboard blockers_for_king(Color c) const;
Bitboard check_squares(PieceType pt) const;
+ bool is_discovery_check_on_king(Color c, Move m) const;
// Attacks to/from a given square
Bitboard attackers_to(Square s) const;
return st->epSquare;
}
-inline int Position::semiopen_file(Color c, File f) const {
- return !(pieces(c, PAWN) & file_bb(f));
+inline bool Position::is_on_semiopen_file(Color c, Square s) const {
+ return !(pieces(c, PAWN) & file_bb(s));
}
inline bool Position::can_castle(CastlingRight cr) const {
return st->checkSquares[pt];
}
+inline bool Position::is_discovery_check_on_king(Color c, Move m) const {
+ return st->blockersForKing[c] & from_sq(m);
+}
+
inline bool Position::pawn_passed(Color c, Square s) const {
return !(pieces(~c, PAWN) & passed_pawn_span(c, s));
}
inline bool Position::advanced_pawn_push(Move m) const {
return type_of(moved_piece(m)) == PAWN
- && relative_rank(sideToMove, from_sq(m)) > RANK_4;
+ && relative_rank(sideToMove, to_sq(m)) > RANK_5;
}
inline int Position::pawns_on_same_color_squares(Color c, Square s) const {