示例#1
0
        private static void PrintCardPower()
        {
            string rank = Console.ReadLine();
            string suit = Console.ReadLine();

            var card = new Card(rank, suit);

            Console.WriteLine(card.ToString());
        }
示例#2
0
        private void ComputerAI(object sender, EventArgs e)
        {
            shuffledLabel.Content       = "";
            computerResultLabel.Content = "";
            playerResultLabel.Content   = "";
            Card card = _computerDeck.DealCard();

            if (card == null)
            {
                EndGame();
                computerActiveCardCanvas.Children.Clear();
            }
            else
            {
                string cardName = card.Face + card.Suit;
                try
                {
                    DrawCardOnCanvas(computerActiveCardCanvas, cardName);
                }
                catch (FileNotFoundException exc)
                {
                    MessageBox.Show(exc.Message, "File not found", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                computerCardLabel.Content       = card.ToString();
                computerCardNumberLabel.Content = "Card #" + (_computerDeck.CurrentCard + 1);

                dealButton.IsEnabled          = true;
                playerCardCanvas.IsEnabled    = true;
                playerCardLabel.Content       = "";
                playerCardNumberLabel.Content = "";
            }

            playerActiveCardCanvas.Children.Clear();
            _computerPlayTimer.Stop();
        }