Example #1
0
        static void NewRound(CardShuffler cs, Player player, Dealer dealer)
        {
            if (cs.RestockRequired())
            {
                cs.Restock();
            }

            player.AddToHand(cs.Deal());
            dealer.AddToHand(cs.Deal());
            player.AddToHand(cs.Deal());
            dealer.AddToHand(cs.Deal(), false);

            Console.WriteLine();

            dealer.CheckBlackjack();

            if (!dealer.Blackjack)
            {
                Console.WriteLine();

                player.ShowHand();

                player.Turn(cs);

                ConsoleKeyInfo keyInfo;

                if (player.HandValue <= 21 && !player.Blackjack)
                {
                    player.ShowHand();
                    Console.WriteLine("Player has been dealt\n");
                    Console.WriteLine("Dealer's turn");
                    Console.WriteLine("Press 'Enter' to continue\n");

                    do
                    {
                        keyInfo = Console.ReadKey(true);
                    }while (keyInfo.Key != ConsoleKey.Enter);

                    dealer.ShowHand();

                    dealer.Turn(cs);

                    if (!dealer.Blackjack)
                    {
                        Console.WriteLine("Player: " + player.HandValue);
                        Console.WriteLine("Dealer: " + dealer.HandValue);
                    }
                }

                Console.WriteLine();
            }
            else
            {
                player.CheckBlackjack();
            }

            Player.DetermineResult(player, dealer);
            player.ShowRecord();
            dealer.ShowRecord();
        }