X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=5a07193b9c5e9226986f789977f9b27e22d519fe;hp=3d0ffb85d9d3c089d22dbde8951df4955f64f33c;hb=49a9d4cf99e56d071af3060b3f306b9daa0a62a6;hpb=d8f683760c9eb6d2c4714ec83e717dd2143de55c diff --git a/src/position.h b/src/position.h index 3d0ffb85..5a07193b 100644 --- a/src/position.h +++ b/src/position.h @@ -90,6 +90,7 @@ public: Square ep_square() const; bool empty(Square s) const; template int count(Color c) const; + template int count() const; template const Square* squares(Color c) const; template Square square(Color c) const; @@ -154,6 +155,7 @@ public: int rule50_count() const; Score psq_score() const; Value non_pawn_material(Color c) const; + Value non_pawn_material() const; // Position consistency check, for debugging bool pos_is_ok(int* failedStep = nullptr) const; @@ -236,6 +238,10 @@ template inline int Position::count(Color c) const { return pieceCount[make_piece(c, Pt)]; } +template inline int Position::count() const { + return pieceCount[make_piece(WHITE, Pt)] + pieceCount[make_piece(BLACK, Pt)]; +} + template inline const Square* Position::squares(Color c) const { return pieceList[make_piece(c, Pt)]; } @@ -267,6 +273,7 @@ inline Square Position::castling_rook_square(CastlingRight cr) const { template inline Bitboard Position::attacks_from(Square s) const { + assert(Pt != PAWN); return Pt == BISHOP || Pt == ROOK ? attacks_bb(s, byTypeBB[ALL_PIECES]) : Pt == QUEEN ? attacks_from(s) | attacks_from(s) : StepAttacksBB[Pt][s]; @@ -330,6 +337,10 @@ inline Value Position::non_pawn_material(Color c) const { return st->nonPawnMaterial[c]; } +inline Value Position::non_pawn_material() const { + return st->nonPawnMaterial[WHITE] + st->nonPawnMaterial[BLACK]; +} + inline int Position::game_ply() const { return gamePly; }