From: Fabian Fichter Date: Sat, 15 Jun 2019 13:45:57 +0000 (+0200) Subject: Merge official-stockfish/master X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=da30534561dfefd196010dc596352c2675f75779;p=fairystockfish.git Merge official-stockfish/master No functional change. --- da30534561dfefd196010dc596352c2675f75779 diff --cc src/position.cpp index f4c4b99,b8d7b10..f1cb400 --- a/src/position.cpp +++ b/src/position.cpp @@@ -512,29 -399,9 +518,21 @@@ void Position::set_state(StateInfo* si si->key ^= Zobrist::castling[si->castlingRights]; - for (Bitboard b = pieces(PAWN); b; ) - { - Square s = pop_lsb(&b); - si->pawnKey ^= Zobrist::psq[piece_on(s)][s]; - } - - for (Piece pc : Pieces) - for (int cnt = 0; cnt < pieceCount[pc]; ++cnt) - si->materialKey ^= Zobrist::psq[pc][cnt]; + for (Color c = WHITE; c <= BLACK; ++c) + for (PieceType pt = PAWN; pt <= KING; ++pt) + { + Piece pc = make_piece(c, pt); - if (pt != PAWN && pt != KING) - si->nonPawnMaterial[c] += pieceCount[pc] * PieceValue[MG][pc]; + + for (int cnt = 0; cnt < pieceCount[pc]; ++cnt) + si->materialKey ^= Zobrist::psq[pc][cnt]; + + if (piece_drops()) + si->key ^= Zobrist::inHand[pc][pieceCountInHand[c][pt]]; + } + + if (max_check_count()) + for (Color c = WHITE; c <= BLACK; ++c) + si->key ^= Zobrist::checks[c][si->checksGiven[c]]; }