void Position::set_state() const {
st->key = st->materialKey = 0;
- st->pawnKey = Zobrist::noPawns;
st->nonPawnMaterial[WHITE] = st->nonPawnMaterial[BLACK] = VALUE_ZERO;
st->checkersBB = attackers_to(square<KING>(sideToMove)) & pieces(~sideToMove);
Piece pc = piece_on(s);
st->key ^= Zobrist::psq[pc][s];
- if (type_of(pc) == PAWN)
- st->pawnKey ^= Zobrist::psq[pc][s];
-
- else if (type_of(pc) != KING)
+ if (type_of(pc) != KING && type_of(pc) != PAWN)
st->nonPawnMaterial[color_of(pc)] += PieceValue[MG][pc];
}
assert(piece_on(to) == NO_PIECE);
assert(piece_on(capsq) == make_piece(them, PAWN));
}
-
- st->pawnKey ^= Zobrist::psq[captured][capsq];
}
else
st->nonPawnMaterial[them] -= PieceValue[MG][captured];
// Update hash keys
k ^= Zobrist::psq[pc][to] ^ Zobrist::psq[promotion][to];
- st->pawnKey ^= Zobrist::psq[pc][to];
st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion]-1]
^ Zobrist::psq[pc][pieceCount[pc]];
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
st->rule50 = 0;
}
struct StateInfo {
// Copied when making a move
- Key pawnKey;
Key materialKey;
Value nonPawnMaterial[COLOR_NB];
int castlingRights;
? k : k ^ make_key((st->rule50 - (14 - AfterMove)) / 8);
}
-inline Key Position::pawn_key() const {
- return st->pawnKey;
-}
-
inline Key Position::material_key() const {
return st->materialKey;
}