Пример #1
0
        public static void ChooseWinner(Player player, Player pc)
        {
            int playerPoints = player.cards.Sum(x => x.Points);
            int pcPoints     = pc.cards.Sum(x => x.Points);

            PrintConsole.PrintScore(player, pc);

            if (pcPoints == BlackJackNumbers.Blackjack || pcPoints <= BlackJackNumbers.Blackjack && pcPoints > playerPoints ||
                playerPoints > BlackJackNumbers.Blackjack || playerPoints == pcPoints)
            {
                PrintConsole.YouLose();
            }
            if (playerPoints == BlackJackNumbers.Blackjack || playerPoints <= BlackJackNumbers.Blackjack && playerPoints > pcPoints ||
                playerPoints <= BlackJackNumbers.Blackjack && playerPoints > pcPoints)
            {
                PrintConsole.YouWon();
            }
        }
Пример #2
0
        public static bool CheckEnteredAnswer()
        {
            bool   status = true;
            string answer = Console.ReadLine();

            while (answer != Answer.yes && answer != Answer.no)
            {
                PrintConsole.IncorrectAnswer();
                answer = Console.ReadLine();
            }
            ;
            if (answer == Answer.yes)
            {
                status = true;
            }
            if (answer == Answer.no)
            {
                status = false;
            }

            return(status);
        }