internal void RemovePiece(Piece piece, SquareE square) { byte color = (byte)piece.Color; byte type = (byte)piece.Type; BitBoard.RstSquare(ref Occupies[color], square); BitBoard.RstSquare(ref Pieces[type], square); --PieceCount[color, type]; }
private void ClearSquare(SquareE square) { //bool isPiece = false; for (ColorE color = ColorE.White; color <= ColorE.Black; ++color) { Bitboard occupy = Occupies[(byte)color]; if (BitBoard.GetSquare(occupy, square)) { for (PieceE type = PieceE.Pawn; type <= PieceE.King; ++type) { Bitboard piece = Pieces[(byte)type]; if (BitBoard.GetSquare(piece, square)) // occupy & piece { BitBoard.RstSquare(ref Occupies[(byte)color], square); BitBoard.RstSquare(ref Pieces[(byte)type], square); break; //Debug.Assert(!isPiece, "Piece Overlaps"); //isPiece = true; } } } } }