class Program { static void Main(string[] args) { const string TakeCardCommand = "1"; const string StopTakeCardCommand = "2"; const string ExitCommand = "3"; string userInput; bool isWorking = true; Deck deck = new Deck(); while (isWorking) { Console.Clear(); Console.WriteLine($"{TakeCardCommand})Взять карту.\n{StopTakeCardCommand})Закончить брать карты и вывести информацию о них.\n{ExitCommand})Выйти из программы."); userInput = Console.ReadLine(); switch (userInput) { case TakeCardCommand: deck.TakeCard(); break; case StopTakeCardCommand: deck.ShowCards(); break; case ExitCommand: isWorking = false; break; } } } } class Card { public int Number { get; private set; } public Card(int number) { Number = number; } } class Deck { Random random = new Random(); int maxRandom = 6; private List _cards = new List() { new Card(1), new Card(2), new Card(3), new Card(4), new Card(5), new Card(6) }; private List _cardsInHand = new List (); public void TakeCard() { int randomCard; randomCard = random.Next(maxRandom); if (_cards.Count == 0) { Console.WriteLine("Карты закончились"); Console.ReadKey(); } else { for (int i = 0; i < _cards.Count; i++) { if (i == randomCard) { _cardsInHand.Add(_cards[i]); _cards.RemoveAt(i); } } maxRandom--; } } public void ShowCards() { foreach (Card card in _cardsInHand) { Console.WriteLine($"Карта:{card.Number}"); } Console.ReadKey(); Console.WriteLine("Нажмите на любую клавишу."); } } class Player { private List _cardsInHand = new List { }; }