Esempio n. 1
0
        private void FinishHand(PlayerHand playerHand, DealerHand dealerHand)
        {
            var outcome = CalculateOutcome(playerHand, dealerHand);

            if (outcome == Outcome.Win)
            {
                Console.WriteLine($"{playerHand.Player.Name}, you won!");
                playerHand.Win();
                dealerHand.Lose();
            }
            else if (outcome == Outcome.Lose)
            {
                Console.WriteLine($"{playerHand.Player.Name}, you lost.");
                playerHand.Lose();
                dealerHand.Win();
            }
            else
            {
                Console.WriteLine($"{playerHand.Player.Name}, you pushed.");
                playerHand.Push();
                dealerHand.Push();
            }

            Thread.Sleep(2000);

            dealerHand.Dealer.Sweep(DiscardTray, playerHand);

            Draw();
        }
Esempio n. 2
0
        private void Bust(PlayerHand hand)
        {
            hand.Lose();
            Dealer.Hand.Win();
            Dealer.Sweep(DiscardTray, hand);
            Thread.Sleep(2000);
            Draw();

            if (!HasActivePlayers)
            {
                Draw();
                Thread.Sleep(2000);
                Dealer.Sweep(DiscardTray, Dealer.Hand); //sweep own hand
                Dealer.Reset();
                Draw();
                Thread.Sleep(2000);
            }
        }