X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.h;h=2e6014dbe6ebb3170d8275c6da11083d4086c0db;hb=e1dd005583bd6c2aaf58468efc5de86a3936380a;hp=1fc6b3b89c4ab2726b9605d5afc50a326e969bfc;hpb=6ce225bb4c31298b131714eff67b56de3b8ee78d;p=stockfish diff --git a/src/position.h b/src/position.h index 1fc6b3b8..2e6014db 100644 --- a/src/position.h +++ b/src/position.h @@ -92,10 +92,9 @@ public: // Position representation Bitboard pieces(PieceType pt) const; - Bitboard pieces(PieceType pt1, PieceType pt2) const; + template Bitboard pieces(PieceType pt, PieceTypes... pts) const; Bitboard pieces(Color c) const; - Bitboard pieces(Color c, PieceType pt) const; - Bitboard pieces(Color c, PieceType pt1, PieceType pt2) const; + template Bitboard pieces(Color c, PieceTypes... pts) const; Piece piece_on(Square s) const; Square ep_square() const; bool empty(Square s) const; @@ -145,6 +144,7 @@ public: // Static Exchange Evaluation bool see_ge(Move m, Value threshold = VALUE_ZERO) const; + bool see_ge(Move m, Bitboard& occupied, Value threshold = VALUE_ZERO) const; // Accessing hash keys Key key() const; @@ -179,8 +179,8 @@ public: private: // Initialization helpers (used while setting up a position) void set_castling_right(Color c, Square rfrom); - void set_state(StateInfo* si) const; - void set_check_info(StateInfo* si) const; + void set_state() const; + void set_check_info() const; // Other helpers void move_piece(Square from, Square to); @@ -228,20 +228,18 @@ inline Bitboard Position::pieces(PieceType pt = ALL_PIECES) const { return byTypeBB[pt]; } -inline Bitboard Position::pieces(PieceType pt1, PieceType pt2) const { - return pieces(pt1) | pieces(pt2); +template +inline Bitboard Position::pieces(PieceType pt, PieceTypes... pts) const { + return pieces(pt) | pieces(pts...); } inline Bitboard Position::pieces(Color c) const { return byColorBB[c]; } -inline Bitboard Position::pieces(Color c, PieceType pt) const { - return pieces(c) & pieces(pt); -} - -inline Bitboard Position::pieces(Color c, PieceType pt1, PieceType pt2) const { - return pieces(c) & (pieces(pt1) | pieces(pt2)); +template +inline Bitboard Position::pieces(Color c, PieceTypes... pts) const { + return pieces(c) & pieces(pts...); } template inline int Position::count(Color c) const { @@ -393,7 +391,7 @@ inline bool Position::capture(Move m) const { // is needed to avoid the generation of duplicate moves. inline bool Position::capture_stage(Move m) const { assert(is_ok(m)); - return capture(m) || (type_of(m) == PROMOTION && promotion_type(m) == QUEEN); + return capture(m) || promotion_type(m) == QUEEN; } inline Piece Position::captured_piece() const {