X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=1bb2e3888e47edfe155cf863f68b7ec0efc0b126;hp=eec8ff7494df11a72c5d376b693d98193165c57c;hb=08abe8b4a33ab409f5b61ebcb9216ddf8a605e95;hpb=782c3f36ccd4aeb52fd7eb92590d5e5e48741eaa diff --git a/src/position.h b/src/position.h index eec8ff74..1bb2e388 100644 --- a/src/position.h +++ b/src/position.h @@ -166,8 +166,7 @@ public: void do_move(Move m, StateInfo& st); void do_move(Move m, StateInfo& st, const CheckInfo& ci, bool moveIsCheck); void undo_move(Move m); - void do_null_move(StateInfo& st); - void undo_null_move(); + template void do_null_move(StateInfo& st); // Static exchange evaluation int see(Move m) const; @@ -214,14 +213,12 @@ private: // Initialization helper functions (used while setting up a position) void clear(); void put_piece(Piece p, Square s); - void set_castle(int f, Square ksq, Square rsq); - void set_castling_rights(char token); + void set_castle_right(Square ksq, Square rsq); bool move_is_legal(const Move m) const; // Helper functions for doing and undoing moves void do_capture_move(Key& key, PieceType capture, Color them, Square to, bool ep); - void do_castle_move(Move m); - void undo_castle_move(Move m); + template void do_castle_move(Move m); template Bitboard hidden_checkers() const; @@ -263,7 +260,7 @@ private: // Static variables static Score pieceSquareTable[16][64]; // [piece][square] - static Key zobrist[2][8][64]; // [color][pieceType][square] + static Key zobrist[2][8][64]; // [color][pieceType][square]/[piece count] static Key zobEp[64]; // [square] static Key zobCastle[16]; // [castleRight] static Key zobSideToMove; @@ -371,6 +368,14 @@ inline Bitboard Position::attacks_from(Square s) const { return attacks_from(s) | attacks_from(s); } +inline Bitboard Position::attacks_from(Piece p, Square s) const { + return attacks_from(p, s, occupied_squares()); +} + +inline Bitboard Position::attackers_to(Square s) const { + return attackers_to(s, occupied_squares()); +} + inline Bitboard Position::checkers() const { return st->checkersBB; }