X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=738fe8c9968272de24ec578a636eba5c032d37df;hp=3014b2354b91f12e0c538a8efae7d9d986afbca6;hb=55df3fa2d7631ed67e46f9433aa7f3a71c18e5e7;hpb=c594b989c0a7ff37002a4720e5bb667da70bb476 diff --git a/src/position.h b/src/position.h index 3014b235..738fe8c9 100644 --- a/src/position.h +++ b/src/position.h @@ -21,6 +21,7 @@ #define POSITION_H_INCLUDED #include +#include #include "bitboard.h" #include "types.h" @@ -44,7 +45,7 @@ struct CheckInfo { /// The StateInfo struct stores information we need to restore a Position /// object to its previous state when we retract a move. Whenever a move -/// is made on the board (by calling Position::do_move), an StateInfo object +/// is made on the board (by calling Position::do_move), a StateInfo object /// must be passed as a parameter. struct StateInfo { @@ -60,13 +61,10 @@ struct StateInfo { StateInfo* previous; }; -struct ReducedStateInfo { - Key pawnKey, materialKey; - Value npMaterial[COLOR_NB]; - int castleRights, rule50, pliesFromNull; - Score psqScore; - Square epSquare; -}; + +/// When making a move the current StateInfo up to 'key' excluded is copied to +/// the new one. Here we calculate the quad words (64bits) needed to be copied. +const size_t StateCopySize64 = offsetof(StateInfo, key) / sizeof(uint64_t) + 1; /// The position data structure. A position consists of the following data: @@ -95,13 +93,13 @@ class Position { 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; @@ -139,7 +137,6 @@ public: // 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;