mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 11:39:15 +00:00
Fixed incorrect material key update when making promotion moves.
This commit is contained in:
parent
e01fefbbaf
commit
e9aa20ad13
1 changed files with 4 additions and 4 deletions
|
@ -829,6 +829,10 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
|
||||||
set_bit(&(byTypeBB[promotion]), to);
|
set_bit(&(byTypeBB[promotion]), to);
|
||||||
board[to] = piece_of_color_and_type(us, promotion);
|
board[to] = piece_of_color_and_type(us, promotion);
|
||||||
|
|
||||||
|
// Update material key
|
||||||
|
st->materialKey ^= zobMaterial[us][PAWN][pieceCount[us][PAWN]];
|
||||||
|
st->materialKey ^= zobMaterial[us][promotion][pieceCount[us][promotion]+1];
|
||||||
|
|
||||||
// Update piece counts
|
// Update piece counts
|
||||||
pieceCount[us][PAWN]--;
|
pieceCount[us][PAWN]--;
|
||||||
pieceCount[us][promotion]++;
|
pieceCount[us][promotion]++;
|
||||||
|
@ -845,10 +849,6 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
|
||||||
key ^= zobrist[us][PAWN][to] ^ zobrist[us][promotion][to];
|
key ^= zobrist[us][PAWN][to] ^ zobrist[us][promotion][to];
|
||||||
st->pawnKey ^= zobrist[us][PAWN][to];
|
st->pawnKey ^= zobrist[us][PAWN][to];
|
||||||
|
|
||||||
// Update material key
|
|
||||||
st->materialKey ^= zobMaterial[us][PAWN][pieceCount[us][PAWN]];
|
|
||||||
st->materialKey ^= zobMaterial[us][promotion][pieceCount[us][promotion]+1];
|
|
||||||
|
|
||||||
// Partially revert and update incremental scores
|
// Partially revert and update incremental scores
|
||||||
st->mgValue -= pst<MidGame>(us, PAWN, to);
|
st->mgValue -= pst<MidGame>(us, PAWN, to);
|
||||||
st->mgValue += pst<MidGame>(us, promotion, to);
|
st->mgValue += pst<MidGame>(us, promotion, to);
|
||||||
|
|
Loading…
Add table
Reference in a new issue