X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=d05546f75ff7d6cae1157d92be10ae79b86eb37c;hp=743acf33ae8beee115c744a4c2effcd7988a7f7f;hb=1d2247aea39074d8ecea4a5ce81b1cf85165538e;hpb=20d7197a9be9c03f153c7ceac73857da8416bba4 diff --git a/src/position.h b/src/position.h index 743acf33..d05546f7 100644 --- a/src/position.h +++ b/src/position.h @@ -86,8 +86,8 @@ struct UndoInfo { Key key, pawnKey, materialKey; int rule50; Move lastMove; - PieceType capture; Value mgValue, egValue; + PieceType capture; }; @@ -122,11 +122,11 @@ class Position { public: // Constructors Position() {}; - Position(const Position &pos); - Position(const std::string &fen); + Position(const Position& pos); + Position(const std::string& fen); // Text input/output - void from_fen(const std::string &fen); + void from_fen(const std::string& fen); const std::string to_fen() const; void print(Move m = MOVE_NONE) const; @@ -253,6 +253,7 @@ public: // Static exchange evaluation int see(Square from, Square to) const; int see(Move m) const; + int see(Square to) const; // Accessing hash keys Key get_key() const; @@ -267,7 +268,7 @@ public: Value mg_pst_delta(Move m) const; // Game termination checks - bool is_mate(); + bool is_mate() const; bool is_draw() const; // Check if one side threatens a mate in one @@ -307,6 +308,9 @@ private: void undo_ep_move(Move m); void find_checkers(); + template + void update_checkers(Bitboard* pCheckersBB, Square ksq, Square from, Square to, Bitboard dcCandidates); + template Bitboard hidden_checks(Color c, Square ksq) const; @@ -570,6 +574,16 @@ Bitboard Position::piece_attacks_square(Square f, Square t) const { return bit_is_set(piece_attacks(f), t); } +inline Bitboard Position::attacks_to(Square s, Color c) const { + + return attacks_to(s) & pieces_of_color(c); +} + +inline bool Position::square_is_attacked(Square s, Color c) const { + + return attacks_to(s, c) != EmptyBoardBB; +} + inline bool Position::pawn_is_passed(Color c, Square s) const { return !(pawns(opposite_color(c)) & passed_pawn_mask(c, s)); }