StateInfo* previous;
};
+struct ReducedStateInfo {
+ Key pawnKey, materialKey;
+ Value npMaterial[2];
+ int castleRights, rule50, pliesFromNull;
+ Score psqScore;
+ Square epSquare;
+};
+
/// The position data structure. A position consists of the following data:
///
// Properties of moves
bool move_gives_check(Move m, const CheckInfo& ci) const;
bool move_attacks_square(Move m, Square s) 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;
void clear();
void put_piece(Piece p, Square s);
void set_castle_right(Color c, Square rfrom);
- bool move_is_legal(const Move m) const;
// Helper template functions
template<bool Do> void do_castle_move(Move m);
}
inline int Position::can_castle(Color c) const {
- return st->castleRights & ((WHITE_OO | WHITE_OOO) << c);
+ return st->castleRights & ((WHITE_OO | WHITE_OOO) << (2 * c));
}
inline bool Position::castle_impeded(Color c, CastlingSide s) const {
inline bool Position::is_capture_or_promotion(Move m) const {
assert(is_ok(m));
- return is_special(m) ? !is_castle(m) : !is_empty(to_sq(m));
+ return type_of(m) ? type_of(m) != CASTLE : !is_empty(to_sq(m));
}
inline bool Position::is_capture(Move m) const {
// Note that castle is coded as "king captures the rook"
assert(is_ok(m));
- return (!is_empty(to_sq(m)) && !is_castle(m)) || is_enpassant(m);
+ return (!is_empty(to_sq(m)) && type_of(m) != CASTLE) || type_of(m) == ENPASSANT;
}
inline PieceType Position::captured_piece_type() const {