/// The checkInfo struct is initialized at c'tor time and keeps info used
/// to detect if a move gives check.
class Position;
-class Thread;
+struct Thread;
struct CheckInfo {
public:
Position() {}
Position(const Position& p, Thread* t) { *this = p; thisThread = t; }
- Position(const std::string& f, bool c960, Thread* t) { from_fen(f, c960, t); }
+ Position(const std::string& f, bool c960, Thread* t) { set(f, c960, t); }
Position& operator=(const Position&);
// Text input/output
- void from_fen(const std::string& fen, bool isChess960, Thread* th);
- const std::string to_fen() const;
- void print(Move m = MOVE_NONE) const;
+ void set(const std::string& fen, bool isChess960, Thread* th);
+ const std::string fen() const;
+ const std::string pretty(Move m = MOVE_NONE) const;
// Position representation
Bitboard pieces() const;
Square castle_rook_square(Color c, CastlingSide s) const;
// Checking
- bool in_check() const;
Bitboard checkers() const;
Bitboard discovered_check_candidates() const;
Bitboard pinned_pieces() const;
// Properties of moves
bool move_gives_check(Move m, const CheckInfo& ci) const;
- bool move_is_legal(const Move m) const;
bool pl_move_is_legal(Move m, Bitboard pinned) const;
bool is_pseudo_legal(const Move m) const;
bool is_capture(Move m) const;
return st->checkersBB;
}
-inline bool Position::in_check() const {
- return st->checkersBB != 0;
-}
-
inline Bitboard Position::discovered_check_candidates() const {
return hidden_checkers<false>();
}