X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=340cbdb1e9c0a25a0eead1e7945d9dafb9dccc7d;hp=cc70bcf815fbd8c58cf3366f9afca5905f5dd6d3;hb=1e7aaed8bc;hpb=0da461f23b84990d17e1f1341aeb7c0589ab98e7 diff --git a/src/position.h b/src/position.h index cc70bcf8..340cbdb1 100644 --- a/src/position.h +++ b/src/position.h @@ -27,7 +27,6 @@ #include "bitboard.h" #include "color.h" -#include "direction.h" #include "move.h" #include "piece.h" #include "square.h" @@ -48,6 +47,8 @@ const int MaxGameLength = 220; //// Types //// +class Position; + /// struct checkInfo is initialized at c'tor time and keeps /// info used to detect if a move gives check. @@ -135,10 +136,10 @@ public: // Constructors Position(const Position& pos, int threadID); - Position(const std::string& fen, int threadID); + Position(const std::string& fen, bool isChess960, int threadID); // Text input/output - void from_fen(const std::string& fen); + void from_fen(const std::string& fen, bool isChess960); const std::string to_fen() const; void print(Move m = MOVE_NONE) const; @@ -197,6 +198,7 @@ public: // Information about attacks to or from a given square Bitboard attackers_to(Square s) const; Bitboard attacks_from(Piece p, Square s) const; + static Bitboard attacks_from(Piece p, Square s, Bitboard occ); template Bitboard attacks_from(Square s) const; template Bitboard attacks_from(Square s, Color c) const; @@ -221,6 +223,7 @@ public: // Doing and undoing moves void detach(); + void do_setup_move(Move m, StateInfo& St); void do_move(Move m, StateInfo& st); void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck); void undo_move(Move m); @@ -250,9 +253,7 @@ public: // Check if side to move could be mated in one bool has_mate_threat(); - // Number of plies since the last non-reversible move - int rule_50_counter() const; - + // Number of plies from starting position int startpos_ply_counter() const; // Other properties of the position @@ -263,9 +264,6 @@ public: // Current thread ID searching on the position int thread() const; - // Reset the gamePly variable to 0 - void reset_game_ply(); - void inc_startpos_ply_counter(); int64_t nodes_searched() const; void set_nodes_searched(int64_t n); @@ -456,12 +454,12 @@ inline Square Position::initial_qr_square(Color c) const { template<> inline Bitboard Position::attacks_from(Square s, Color c) const { - return StepAttackBB[piece_of_color_and_type(c, PAWN)][s]; + return NonSlidingAttacksBB[piece_of_color_and_type(c, PAWN)][s]; } template // Knight and King and white pawns inline Bitboard Position::attacks_from(Square s) const { - return StepAttackBB[Piece][s]; + return NonSlidingAttacksBB[Piece][s]; } template<> @@ -534,10 +532,6 @@ inline bool Position::move_is_passed_pawn_push(Move m) const { && pawn_is_passed(c, move_to(m)); } -inline int Position::rule_50_counter() const { - return st->rule50; -} - inline int Position::startpos_ply_counter() const { return startPosPlyCounter; }