From: Tord Romstad Date: Thu, 20 Aug 2009 14:54:20 +0000 (+0200) Subject: Fixed incorrect material key update when making promotion moves. X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=e9aa20ad132b569c7a9e60322a25aeef94a3375a Fixed incorrect material key update when making promotion moves. --- 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);