X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.h;h=f2f517e219445a601f4d90690572cb1a40e1b288;hb=b50921fd5c3e1753adecfea77557ad1afece7641;hp=a051ec382f49fe15a0d3ee55238e97a48c1158ac;hpb=e4277c06bfb783b5ec78001eeef06fa9feae033f;p=stockfish diff --git a/src/position.h b/src/position.h index a051ec38..f2f517e2 100644 --- a/src/position.h +++ b/src/position.h @@ -88,8 +88,8 @@ enum Phase { struct StateInfo { Key key, pawnKey, materialKey; - int castleRights, rule50; - Square kingSquare[2], epSquare; + int castleRights, rule50, pliesFromNull; + Square epSquare; Value mgValue, egValue; Value npMaterial[2]; @@ -193,6 +193,7 @@ public: // Piece lists Square piece_list(Color c, PieceType pt, int index) const; + const Square* piece_list_begin(Color c, PieceType pt) const; // Information about attacks to or from a given square Bitboard attackers_to(Square s) const; @@ -206,6 +207,7 @@ public: bool move_is_check(Move m) const; bool move_is_check(Move m, Bitboard dcCandidates) const; bool move_is_capture(Move m) const; + bool move_is_capture_or_promotion(Move m) const; bool move_is_passed_pawn_push(Move m) const; bool move_attacks_square(Move m, Square s) const; @@ -298,12 +300,12 @@ private: template Value compute_value() const; Value compute_non_pawn_material(Color c) const; - // Bitboards - Bitboard byColorBB[2], byTypeBB[8]; - // Board Piece board[64]; + // Bitboards + Bitboard byTypeBB[8], byColorBB[2]; + // Piece counts int pieceCount[2][8]; // [color][pieceType] @@ -403,12 +405,16 @@ inline Square Position::piece_list(Color c, PieceType pt, int index) const { return pieceList[c][pt][index]; } +inline const Square* Position::piece_list_begin(Color c, PieceType pt) const { + return pieceList[c][pt]; +} + inline Square Position::ep_square() const { return st->epSquare; } inline Square Position::king_square(Color c) const { - return st->kingSquare[c]; + return pieceList[c][KING][0]; } inline bool Position::can_castle_kingside(Color side) const { @@ -563,8 +569,13 @@ inline bool Position::has_pawn_on_7th(Color c) const { inline bool Position::move_is_capture(Move m) const { // Move must not be MOVE_NONE ! + return (m & (3 << 15)) ? !move_is_castle(m) : !square_is_empty(move_to(m)); +} - return (!square_is_empty(move_to(m)) && !move_is_castle(m)) || move_is_ep(m); +inline bool Position::move_is_capture_or_promotion(Move m) const { + + // Move must not be MOVE_NONE ! + return (m & (0x1F << 12)) ? !move_is_castle(m) : !square_is_empty(move_to(m)); } #endif // !defined(POSITION_H_INCLUDED)