X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fposition.h;h=b66cc67f310105710d7682615420159f6db2dbca;hb=eeb6d923fa5e773ba223c0cede75705c1f3d9e89;hp=72932f778e9c07af6bcb9ce89e2822a8b78ddc61;hpb=74829342efcb93a6f581f69e293a02d3e2cfc507;p=stockfish diff --git a/src/position.h b/src/position.h index 72932f77..b66cc67f 100644 --- a/src/position.h +++ b/src/position.h @@ -73,6 +73,9 @@ const size_t StateCopySize64 = offsetof(StateInfo, key) / sizeof(uint64_t) + 1; /// when traversing the search tree. class Position { + + friend std::ostream& operator<<(std::ostream&, const Position&); + public: Position() {} Position(const Position& pos, Thread* t) { *this = pos; thisThread = t; } @@ -80,10 +83,9 @@ public: Position& operator=(const Position&); static void init(); - // Text input/output + // FEN string input/output void set(const std::string& fenStr, bool isChess960, Thread* th); const std::string fen() const; - const std::string pretty() const; // Position representation Bitboard pieces() const; @@ -164,6 +166,7 @@ public: uint64_t nodes_searched() const; void set_nodes_searched(uint64_t n); bool is_draw() const; + int rule50_count() const; // Position consistency check, for debugging bool pos_is_ok(int* step = NULL) const; @@ -350,6 +353,10 @@ inline int Position::game_ply() const { return gamePly; } +inline int Position::rule50_count() const { + return st->rule50; +} + inline bool Position::opposite_bishops() const { return pieceCount[WHITE][BISHOP] == 1 @@ -400,6 +407,7 @@ inline void Position::put_piece(Square s, Color c, PieceType pt) { byColorBB[c] |= s; index[s] = pieceCount[c][pt]++; pieceList[c][pt][index[s]] = s; + pieceCount[c][ALL_PIECES]++; } inline void Position::move_piece(Square from, Square to, Color c, PieceType pt) { @@ -430,6 +438,7 @@ inline void Position::remove_piece(Square s, Color c, PieceType pt) { index[lastSquare] = index[s]; pieceList[c][pt][index[lastSquare]] = lastSquare; pieceList[c][pt][pieceCount[c][pt]] = SQ_NONE; + pieceCount[c][ALL_PIECES]--; } #endif // #ifndef POSITION_H_INCLUDED