X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=fced8e0c974c8a50c1921954ca62e1177975af46;hp=27a70aaedde51b83a25cb22a216f474dde603896;hb=e304db9d1ecf6a2318708483c90fadecf4fac4ee;hpb=dc7fd868f4fa41251a9521a0b25e3adb483bfd83 diff --git a/src/position.h b/src/position.h index 27a70aae..fced8e0c 100644 --- a/src/position.h +++ b/src/position.h @@ -37,7 +37,7 @@ struct CheckInfo { Bitboard dcCandidates; Bitboard pinned; - Bitboard checkSq[8]; + Bitboard checkSq[PIECE_TYPE_NB]; Square ksq; }; @@ -49,7 +49,7 @@ struct CheckInfo { struct StateInfo { Key pawnKey, materialKey; - Value npMaterial[2]; + Value npMaterial[COLOR_NB]; int castleRights, rule50, pliesFromNull; Score psqScore; Square epSquare; @@ -62,7 +62,7 @@ struct StateInfo { struct ReducedStateInfo { Key pawnKey, materialKey; - Value npMaterial[2]; + Value npMaterial[COLOR_NB]; int castleRights, rule50, pliesFromNull; Score psqScore; Square epSquare; @@ -94,10 +94,9 @@ struct ReducedStateInfo { class Position { public: Position() {} - Position(const Position& p) { *this = p; } Position(const Position& p, Thread* t) { *this = p; thisThread = t; } Position(const std::string& f, bool c960, Thread* t) { from_fen(f, c960, t); } - void operator=(const Position&); + Position& operator=(const Position&); // Text input/output void from_fen(const std::string& fen, bool isChess960, Thread* th); @@ -190,9 +189,6 @@ public: bool pos_is_ok(int* failedStep = NULL) const; void flip(); - // Global initialization - static void init(); - private: // Initialization helpers (used while setting up a position) void clear(); @@ -213,17 +209,17 @@ private: Value compute_non_pawn_material(Color c) const; // Board and pieces - Piece board[64]; // [square] - Bitboard byTypeBB[8]; // [pieceType] - Bitboard byColorBB[2]; // [color] - int pieceCount[2][8]; // [color][pieceType] - Square pieceList[2][8][16]; // [color][pieceType][index] - int index[64]; // [square] + Piece board[SQUARE_NB]; + Bitboard byTypeBB[PIECE_TYPE_NB]; + Bitboard byColorBB[COLOR_NB]; + int pieceCount[COLOR_NB][PIECE_TYPE_NB]; + Square pieceList[COLOR_NB][PIECE_TYPE_NB][16]; + int index[SQUARE_NB]; // Other info - int castleRightsMask[64]; // [square] - Square castleRookSquare[2][2]; // [color][side] - Bitboard castlePath[2][2]; // [color][side] + int castleRightsMask[SQUARE_NB]; + Square castleRookSquare[COLOR_NB][CASTLING_SIDE_NB]; + Bitboard castlePath[COLOR_NB][CASTLING_SIDE_NB]; StateInfo startState; int64_t nodes; int startPosPly; @@ -231,14 +227,6 @@ private: Thread* thisThread; StateInfo* st; int chess960; - - // Static variables - static Score pieceSquareTable[16][64]; // [piece][square] - static Key zobrist[2][8][64]; // [color][pieceType][square]/[piece count] - static Key zobEp[8]; // [file] - static Key zobCastle[16]; // [castleRight] - static Key zobSideToMove; - static Key zobExclusion; }; inline int64_t Position::nodes_searched() const { @@ -367,7 +355,7 @@ inline Key Position::key() const { } inline Key Position::exclusion_key() const { - return st->key ^ zobExclusion; + return st->key ^ Zobrist::exclusion; } inline Key Position::pawn_key() const {