st->npMaterial[them] -= PieceValueMidgame[capture];
// Remove the captured piece
- byColorBB[them] ^= capsq;
+ byTypeBB[ALL_PIECES] ^= capsq;
byTypeBB[capture] ^= capsq;
- occupied ^= capsq;
+ byColorBB[them] ^= capsq;
// Update piece list, move the last piece at index[capsq] position and
// shrink the list.
// Move the piece
Bitboard from_to_bb = SquareBB[from] | SquareBB[to];
- byColorBB[us] ^= from_to_bb;
+ byTypeBB[ALL_PIECES] ^= from_to_bb;
byTypeBB[pt] ^= from_to_bb;
- occupied ^= from_to_bb;
+ byColorBB[us] ^= from_to_bb;
board[to] = board[from];
board[from] = NO_PIECE;
// Put the piece back at the source square
Bitboard from_to_bb = SquareBB[from] | SquareBB[to];
- byColorBB[us] ^= from_to_bb;
+ byTypeBB[ALL_PIECES] ^= from_to_bb;
byTypeBB[pt] ^= from_to_bb;
- occupied ^= from_to_bb;
+ byColorBB[us] ^= from_to_bb;
board[from] = board[to];
board[to] = NO_PIECE;
}
// Restore the captured piece
- byColorBB[them] |= capsq;
+ byTypeBB[ALL_PIECES] |= capsq;
byTypeBB[capture] |= capsq;
- occupied |= capsq;
+ byColorBB[them] |= capsq;
board[capsq] = make_piece(them, capture);
assert(piece_on(rfrom) == make_piece(us, ROOK));
// Remove pieces from source squares
- byColorBB[us] ^= kfrom;
+ byTypeBB[ALL_PIECES] ^= kfrom;
byTypeBB[KING] ^= kfrom;
- occupied ^= kfrom;
- byColorBB[us] ^= rfrom;
+ byColorBB[us] ^= kfrom;
+ byTypeBB[ALL_PIECES] ^= rfrom;
byTypeBB[ROOK] ^= rfrom;
- occupied ^= rfrom;
+ byColorBB[us] ^= rfrom;
// Put pieces on destination squares
- byColorBB[us] |= kto;
+ byTypeBB[ALL_PIECES] |= kto;
byTypeBB[KING] |= kto;
- occupied |= kto;
- byColorBB[us] |= rto;
+ byColorBB[us] |= kto;
+ byTypeBB[ALL_PIECES] |= rto;
byTypeBB[ROOK] |= rto;
- occupied |= rto;
+ byColorBB[us] |= rto;
// Update board
Piece king = make_piece(us, KING);
index[s] = pieceCount[c][pt]++;
pieceList[c][pt][index[s]] = s;
+ byTypeBB[ALL_PIECES] |= s;
byTypeBB[pt] |= s;
byColorBB[c] |= s;
- occupied |= s;
}