Key pawnKey, materialKey;
Value npMaterial[COLOR_NB];
int castleRights, rule50, pliesFromNull;
Key pawnKey, materialKey;
Value npMaterial[COLOR_NB];
int castleRights, rule50, pliesFromNull;
Position(const Position& p, Thread* t) { *this = p; thisThread = t; }
Position(const std::string& f, bool c960, Thread* t) { set(f, c960, t); }
Position& operator=(const Position&);
Position(const Position& p, Thread* t) { *this = p; thisThread = t; }
Position(const std::string& f, bool c960, Thread* t) { set(f, c960, t); }
Position& operator=(const Position&);
Square king_square(Color c) const;
Square ep_square() const;
bool is_empty(Square s) const;
Square king_square(Color c) const;
Square ep_square() const;
bool is_empty(Square s) const;
- const Square* piece_list(Color c, PieceType pt) const;
- int piece_count(Color c, PieceType pt) const;
+ template<PieceType Pt> int count(Color c) const;
+ template<PieceType Pt> const Square* list(Color c) const;
Thread* this_thread() const;
int64_t nodes_searched() const;
void set_nodes_searched(int64_t n);
Thread* this_thread() const;
int64_t nodes_searched() const;
void set_nodes_searched(int64_t n);
// Position consistency check, for debugging
bool pos_is_ok(int* failedStep = NULL) const;
// Position consistency check, for debugging
bool pos_is_ok(int* failedStep = NULL) const;
// Helper functions
void do_castle(Square kfrom, Square kto, Square rfrom, Square rto);
// Helper functions
void do_castle(Square kfrom, Square kto, Square rfrom, Square rto);
-inline int Position::piece_count(Color c, PieceType pt) const {
- return pieceCount[c][pt];
+template<PieceType Pt> inline int Position::count(Color c) const {
+ return pieceCount[c][Pt];
-inline const Square* Position::piece_list(Color c, PieceType pt) const {
- return pieceList[c][pt];
+template<PieceType Pt> inline const Square* Position::list(Color c) const {
+ return pieceList[c][Pt];