X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=343751ede6201175c894c99c68c002b6495625ff;hp=03c00148a084636fbeac4370f55635890ec0c46f;hb=f9518de974fdf1931dbead736364efce9537320b;hpb=82ad9ce9cfb0eff33f1d781f329f7c5dc0b277eb diff --git a/src/position.h b/src/position.h index 03c00148..343751ed 100644 --- a/src/position.h +++ b/src/position.h @@ -46,6 +46,7 @@ struct StateInfo { Square epSquare; // Not copied when making a move (will be recomputed anyhow) + int repetition; Key key; Bitboard checkersBB; Piece capturedPiece; @@ -95,6 +96,7 @@ public: template int count() const; template const Square* squares(Color c) const; template Square square(Color c) const; + bool is_on_semiopen_file(Color c, Square s) const; // Castling int castling_rights(Color c) const; @@ -128,6 +130,7 @@ public: // Piece specific bool pawn_passed(Color c, Square s) const; bool opposite_bishops() const; + int pawns_on_same_color_squares(Color c, Square s) const; // Doing and undoing moves void do_move(Move m, StateInfo& newSt); @@ -260,6 +263,10 @@ inline Square Position::ep_square() const { return st->epSquare; } +inline bool Position::is_on_semiopen_file(Color c, Square s) const { + return !(pieces(c, PAWN) & file_bb(s)); +} + inline bool Position::can_castle(CastlingRight cr) const { return st->castlingRights & cr; } @@ -315,7 +322,11 @@ inline bool Position::pawn_passed(Color c, Square s) const { inline bool Position::advanced_pawn_push(Move m) const { return type_of(moved_piece(m)) == PAWN - && relative_rank(sideToMove, from_sq(m)) > RANK_4; + && relative_rank(sideToMove, to_sq(m)) > RANK_5; +} + +inline int Position::pawns_on_same_color_squares(Color c, Square s) const { + return popcount(pieces(c, PAWN) & ((DarkSquares & s) ? DarkSquares : ~DarkSquares)); } inline Key Position::key() const {