explicit CheckInfo(const Position&);
Bitboard dcCandidates;
+ Bitboard pinned;
Bitboard checkSq[8];
- Square ksq;
};
/// Castle rights, encoded as bit fields
// Properties of moves
bool pl_move_is_legal(Move m, Bitboard pinned) const;
bool move_is_pl(const Move m) const;
- bool move_gives_check(Move m) const;
bool move_gives_check(Move m, const CheckInfo& ci) const;
bool move_is_capture(Move m) const;
+ bool move_is_capture_or_promotion(Move m) const;
bool move_is_passed_pawn_push(Move m) const;
bool move_attacks_square(Move m, Square s) const;
// Position consistency check, for debugging
bool is_ok(int* failedStep = NULL) const;
- // Static member functions
- static void init_zobrist();
- static void init_piece_square_tables();
+ // Global initialization
+ static void init();
private:
return chess960;
}
+inline bool Position::move_is_capture_or_promotion(Move m) const {
+
+ assert(m != MOVE_NONE && m != MOVE_NULL);
+ return move_is_special(m) ? !move_is_castle(m) : !square_is_empty(move_to(m));
+}
+
inline bool Position::move_is_capture(Move m) const {
- assert (m != MOVE_NONE && m != MOVE_NULL);
- return !move_is_special(m) ? !square_is_empty(move_to(m)) : move_is_ep(m);
+ assert(m != MOVE_NONE && m != MOVE_NULL);
+
+ // Note that castle is coded as "king captures the rook"
+ return (!square_is_empty(move_to(m)) && !move_is_castle(m)) || move_is_ep(m);
}
inline PieceType Position::captured_piece_type() const {