-
- // Initialization helper functions (used while setting up a position)
- void clear();
- void detach();
- void put_piece(Piece p, Square s);
- void set_castle_kingside(Color c);
- void set_castle_queenside(Color c);
- bool set_castling_rights(char token);
- bool move_is_pl_slow(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);
- void find_checkers();
-
- template<bool FindPinned>
- Bitboard hidden_checkers(Color c) const;
-
- // Computing hash keys from scratch (for initialization and debugging)
- Key compute_key() const;
- Key compute_pawn_key() const;
- Key compute_material_key() const;
-
- // Computing incremental evaluation scores and material counts
- static Score pst(Color c, PieceType pt, Square s);
- Score compute_value() const;
- Value compute_non_pawn_material(Color c) const;
-
- // Board
- Piece board[64];
-
- // Bitboards
- Bitboard byTypeBB[8], byColorBB[2];
-
- // Piece counts
- int pieceCount[2][8]; // [color][pieceType]
-
- // Piece lists
- Square pieceList[2][8][16]; // [color][pieceType][index]
- int index[64]; // [square]
-
- // Other info
+ // 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;
+
+ // Other helpers
+ void put_piece(Piece pc, Square s);
+ void remove_piece(Piece pc, Square s);
+ void move_piece(Piece pc, Square from, Square to);
+ template<bool Do>
+ void do_castling(Color us, Square from, Square& to, Square& rfrom, Square& rto);
+
+ // Data members
+ Piece board[SQUARE_NB];
+ Bitboard byTypeBB[PIECE_TYPE_NB];
+ Bitboard byColorBB[COLOR_NB];
+ int pieceCount[PIECE_NB];
+ Square pieceList[PIECE_NB][16];
+ int index[SQUARE_NB];
+ int castlingRightsMask[SQUARE_NB];
+ Square castlingRookSquare[CASTLING_RIGHT_NB];
+ Bitboard castlingPath[CASTLING_RIGHT_NB];
+ int gamePly;