Esempio n. 1
0
        private void PlayRound()
        {
            char    playerResponse = Variables.Take;
            Results result         = Results.NoResult;

            while (result == Results.NoResult)
            {
                ShowCards(false);
                playerResponse = _display.PlayDialog(false);
                if (playerResponse == Variables.Take)
                {
                    _dealer.AddCard(_player);
                    result = _dealer.CalculateResult(_player, _computer, false);
                }
                if (playerResponse == Variables.Pass)
                {
                    _dealer.AddCard(_computer);
                    result = _dealer.CalculateResult(_player, _computer, true);
                }
            }

            ChangeStatistic(result);
            _display.ShowResult(result);
            ShowCards(true);
        }
Esempio n. 2
0
        public void PlayRound()
        {
            int   playerStake = 1;
            Moves playerStatus;

            player1.RemoveCredit();

            //Deal 1st Card
            dealer.AddCard(deck.DealCard());
            player1.AddCard(deck.DealCard());

            Console.WriteLine(" The Dealer Holds: ");
            Console.WriteLine("{0} {1}\n", dealer.hand.cards[0].Face, dealer.hand.cards[0].Suit);
            Console.WriteLine("You Hold: ");
            DisplayHand(player1.hand);
            //Players Place Bets
            playerStake = IncreaseStake(playerStake, player1.Credits) + playerStake;

            //Deal 2nd Card
            dealer.AddCard(deck.DealCard());
            player1.AddCard(deck.DealCard());
            Console.WriteLine("You Hold: ");
            DisplayHand(player1.hand);

            //Player Hits or Sticks
            playerStatus = PlayerMove();

            if (playerStatus != Moves.Bust)
            //If Player is bust - round ends
            {
                if (player1.hand.Total == 21)
                {
                    //if Player is 21 then Player gets stake X 3
                    Console.WriteLine("21! You win the Hand");
                    player1.AddCredits(playerStake * 3);
                }
                else
                {
                    //Else Dealer Hits or Sticks

                    DealerMove();

                    if (dealer.hand.ValidHand())
                    {
                        if (player1.hand.Total > dealer.hand.Total)
                        {
                            player1.AddCredits(playerStake * 2);
                            Console.WriteLine("You win the Hand");
                        }
                        else
                        {
                            Console.WriteLine("The Dealer wins the hand.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("The Dealer is Bust.");
                        player1.AddCredits(playerStake);
                    }
                }
            }
            else
            {
                Console.WriteLine("You are Bust!");
            }

            player1.hand.ClearHand();
            dealer.hand.ClearHand();
        }