X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=3da25b6f57e4c6e54b8e62af18c84e9717d385ee;hp=761724ad01d5aa9a1d47d47f37cb4bda5d820a8c;hb=5815718177817de90f98513b776bc04376440f0a;hpb=b08ba446f655ba6292cb0b5a1012e790e4ad8d7d diff --git a/src/position.h b/src/position.h index 761724ad..3da25b6f 100644 --- a/src/position.h +++ b/src/position.h @@ -17,14 +17,9 @@ along with this program. If not, see . */ - #if !defined(POSITION_H_INCLUDED) #define POSITION_H_INCLUDED -//// -//// Includes -//// - #include "bitboard.h" #include "color.h" #include "move.h" @@ -32,20 +27,12 @@ #include "square.h" #include "value.h" - -//// -//// Constants -//// - /// Maximum number of plies per game (220 should be enough, because the /// maximum search depth is 100, and during position setup we reset the /// move counter for every non-reversible move). 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. @@ -220,8 +207,7 @@ public: bool square_is_weak(Square s, Color c) const; // Doing and undoing moves - void detach(); - void do_setup_move(Move m, StateInfo& St); + void do_setup_move(Move m); void do_move(Move m, StateInfo& st); void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck); void undo_move(Move m); @@ -276,6 +262,7 @@ private: // Initialization helper functions (used while setting up a position) void clear(); + void detach(); void put_piece(Piece p, Square s); void do_allow_oo(Color c); void do_allow_ooo(Color c); @@ -337,11 +324,6 @@ private: static const Value PieceValueEndgame[17]; }; - -//// -//// Inline functions -//// - inline int64_t Position::nodes_searched() const { return nodes; } @@ -536,13 +518,12 @@ inline int Position::startpos_ply_counter() const { inline bool Position::opposite_colored_bishops() const { - return piece_count(WHITE, BISHOP) == 1 - && piece_count(BLACK, BISHOP) == 1 - && !same_color_squares(piece_list(WHITE, BISHOP, 0), piece_list(BLACK, BISHOP, 0)); + return piece_count(WHITE, BISHOP) == 1 && piece_count(BLACK, BISHOP) == 1 + && opposite_color_squares(piece_list(WHITE, BISHOP, 0), piece_list(BLACK, BISHOP, 0)); } inline bool Position::has_pawn_on_7th(Color c) const { - return pieces(PAWN, c) & relative_rank_bb(c, RANK_7); + return pieces(PAWN, c) & rank_bb(relative_rank(c, RANK_7)); } inline bool Position::is_chess960() const {