From e9aa20ad132b569c7a9e60322a25aeef94a3375a Mon Sep 17 00:00:00 2001 From: Tord Romstad Date: Thu, 20 Aug 2009 16:54:20 +0200 Subject: [PATCH] Fixed incorrect material key update when making promotion moves. --- src/position.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 025a2d72..d37d35b4 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -829,6 +829,10 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) { set_bit(&(byTypeBB[promotion]), to); 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 pieceCount[us][PAWN]--; 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]; 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 st->mgValue -= pst(us, PAWN, to); st->mgValue += pst(us, promotion, to); -- 2.39.2