예제 #1
0
            /// <see cref="IChessBoardCell.RemoveChessPiece"/>
            public void RemoveChessPiece()
            {
                if (containingChessPiece == null)
                {
                    return;
                }

                containingChessPiece.SetParent(null);
                containingChessPiece = null;
            }
예제 #2
0
            /// <see cref="IChessBoardCell.PlaceChessPiece(IChessPiece)"/>
            public void PlaceChessPiece(IChessPiece chessPiece)
            {
                if (!IsEmpty)
                {
                    throw new InvalidOperationException("Cell already contains a chess piece");
                }
                if (chessPiece == null)
                {
                    throw new ArgumentNullException(nameof(chessPiece));
                }

                containingChessPiece = chessPiece;
                containingChessPiece.SetParent(this);
            }