X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.h;h=18be2ec6928df5c695eed3e2cd09af7b46897461;hp=a40687e7797afe35afbcdc2fec61cd98eaaf2a82;hb=a781535168a9ef5ee3602ec495a21bc1838d457a;hpb=af6072c8b7e849c43b69dc286bcc0de6d9b453a1 diff --git a/src/position.h b/src/position.h index a40687e7..18be2ec6 100644 --- a/src/position.h +++ b/src/position.h @@ -43,7 +43,6 @@ struct StateInfo { int castlingRights; int rule50; int pliesFromNull; - Score psq; Square epSquare; // Not copied when making a move (will be recomputed anyhow) @@ -188,11 +187,16 @@ private: Bitboard castlingPath[CASTLING_RIGHT_NB]; int gamePly; Color sideToMove; + Score psq; Thread* thisThread; StateInfo* st; bool chess960; }; +namespace PSQT { + extern Score psq[PIECE_NB][SQUARE_NB]; +} + extern std::ostream& operator<<(std::ostream& os, const Position& pos); inline Color Position::side_to_move() const { @@ -327,7 +331,7 @@ inline Key Position::material_key() const { } inline Score Position::psq_score() const { - return st->psq; + return psq; } inline Value Position::non_pawn_material(Color c) const { @@ -384,6 +388,7 @@ inline void Position::put_piece(Piece pc, Square s) { index[s] = pieceCount[pc]++; pieceList[pc][index[s]] = s; pieceCount[make_piece(color_of(pc), ALL_PIECES)]++; + psq += PSQT::psq[pc][s]; } inline void Position::remove_piece(Piece pc, Square s) { @@ -401,6 +406,7 @@ inline void Position::remove_piece(Piece pc, Square s) { pieceList[pc][index[lastSquare]] = lastSquare; pieceList[pc][pieceCount[pc]] = SQ_NONE; pieceCount[make_piece(color_of(pc), ALL_PIECES)]--; + psq -= PSQT::psq[pc][s]; } inline void Position::move_piece(Piece pc, Square from, Square to) { @@ -415,6 +421,7 @@ inline void Position::move_piece(Piece pc, Square from, Square to) { board[to] = pc; index[to] = index[from]; pieceList[pc][index[to]] = to; + psq += PSQT::psq[pc][to] - PSQT::psq[pc][from]; } inline void Position::do_move(Move m, StateInfo& newSt) {