if (dp.from[i] != SQ_NONE)
removed.push_back(make_index(perspective, dp.from[i], pc, oriented_ksq, pos));
else if (dp.handPiece[i] != NO_PIECE)
- removed.push_back(make_index(perspective, dp.handCount[i], dp.handPiece[i], oriented_ksq, pos));
+ removed.push_back(make_index(perspective, dp.handCount[i] - 1, dp.handPiece[i], oriented_ksq, pos));
if (dp.to[i] != SQ_NONE)
added.push_back(make_index(perspective, dp.to[i], pc, oriented_ksq, pos));
else if (dp.handPiece[i] != NO_PIECE)
Square gate = gating_square(m);
Piece gating_piece = make_piece(us, gating_type(m));
- put_piece(gating_piece, gate);
- remove_from_hand(gating_piece);
-
if (Eval::useNNUE)
{
// Add gating piece
dp.dirty_num++;
}
+ put_piece(gating_piece, gate);
+ remove_from_hand(gating_piece);
+
st->gatesBB[us] ^= gate;
k ^= Zobrist::psq[gating_piece][gate];
st->materialKey ^= Zobrist::psq[gating_piece][pieceCount[gating_piece]];