1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-12 03:59:15 +00:00

Remove pawnKey from StateInfo

Remove pawnKey since it is not used anymore.

Passed Non-regression STC:
https://tests.stockfishchess.org/tests/view/64b023110cdec37b9573265c
LLR: 2.96 (-2.94,2.94) <-1.75,0.25>
Total: 334848 W: 85440 L: 85545 D: 163863
Ptnml(0-2): 1134, 38101, 89075, 37964, 1150

closes https://github.com/official-stockfish/Stockfish/pull/4687

No functional change
This commit is contained in:
maxim 2023-07-13 19:09:02 +03:00 committed by Joost VandeVondele
parent e8a5c64988
commit 18fdc2df3c
2 changed files with 1 additions and 16 deletions

View file

@ -336,7 +336,6 @@ void Position::set_check_info() const {
void Position::set_state() const { void Position::set_state() const {
st->key = st->materialKey = 0; st->key = st->materialKey = 0;
st->pawnKey = Zobrist::noPawns;
st->nonPawnMaterial[WHITE] = st->nonPawnMaterial[BLACK] = VALUE_ZERO; st->nonPawnMaterial[WHITE] = st->nonPawnMaterial[BLACK] = VALUE_ZERO;
st->checkersBB = attackers_to(square<KING>(sideToMove)) & pieces(~sideToMove); st->checkersBB = attackers_to(square<KING>(sideToMove)) & pieces(~sideToMove);
@ -348,10 +347,7 @@ void Position::set_state() const {
Piece pc = piece_on(s); Piece pc = piece_on(s);
st->key ^= Zobrist::psq[pc][s]; st->key ^= Zobrist::psq[pc][s];
if (type_of(pc) == PAWN) if (type_of(pc) != KING && type_of(pc) != PAWN)
st->pawnKey ^= Zobrist::psq[pc][s];
else if (type_of(pc) != KING)
st->nonPawnMaterial[color_of(pc)] += PieceValue[MG][pc]; st->nonPawnMaterial[color_of(pc)] += PieceValue[MG][pc];
} }
@ -745,8 +741,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
assert(piece_on(to) == NO_PIECE); assert(piece_on(to) == NO_PIECE);
assert(piece_on(capsq) == make_piece(them, PAWN)); assert(piece_on(capsq) == make_piece(them, PAWN));
} }
st->pawnKey ^= Zobrist::psq[captured][capsq];
} }
else else
st->nonPawnMaterial[them] -= PieceValue[MG][captured]; st->nonPawnMaterial[them] -= PieceValue[MG][captured];
@ -825,7 +819,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
// Update hash keys // Update hash keys
k ^= Zobrist::psq[pc][to] ^ Zobrist::psq[promotion][to]; k ^= Zobrist::psq[pc][to] ^ Zobrist::psq[promotion][to];
st->pawnKey ^= Zobrist::psq[pc][to];
st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion]-1] st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion]-1]
^ Zobrist::psq[pc][pieceCount[pc]]; ^ Zobrist::psq[pc][pieceCount[pc]];
@ -833,9 +826,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
st->nonPawnMaterial[us] += PieceValue[MG][promotion]; st->nonPawnMaterial[us] += PieceValue[MG][promotion];
} }
// Update pawn hash key
st->pawnKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to];
// Reset rule 50 draw counter // Reset rule 50 draw counter
st->rule50 = 0; st->rule50 = 0;
} }

View file

@ -40,7 +40,6 @@ namespace Stockfish {
struct StateInfo { struct StateInfo {
// Copied when making a move // Copied when making a move
Key pawnKey;
Key materialKey; Key materialKey;
Value nonPawnMaterial[COLOR_NB]; Value nonPawnMaterial[COLOR_NB];
int castlingRights; int castlingRights;
@ -338,10 +337,6 @@ inline Key Position::adjust_key50(Key k) const
? k : k ^ make_key((st->rule50 - (14 - AfterMove)) / 8); ? k : k ^ make_key((st->rule50 - (14 - AfterMove)) / 8);
} }
inline Key Position::pawn_key() const {
return st->pawnKey;
}
inline Key Position::material_key() const { inline Key Position::material_key() const {
return st->materialKey; return st->materialKey;
} }