Ejemplo n.º 1
0
        private void PlayOneRoundOfBlackJack(BlackJackGame game, int bet)
        {
            game.StartNewGame(bet);

            while (game.GameRunning)
            {
                Console.WriteLine("Dealer: {0}", game.GetVisibleDealerCardsAsString());
                Console.WriteLine("Player: {0}", game.GetPlayerCardsAsString());

                Console.WriteLine("One more card (Y/N)?");

                char entry = ' ';
                while ('Y' != entry && 'N' != entry)
                {
                    entry = Char.ToUpper(Console.ReadKey().KeyChar);
                }

                if ('Y' == entry)
                {
                    game.Hit();
                }
                else
                {
                    game.Stand();
                }
            }

            DisplayBlackJackResult(game);
        }
 private void DisplayBlackJackResult(BlackJackGame game)
 {
     Console.WriteLine("Dealers Deck: {0}", game.GetVisibleDealerCardsAsString());
     Console.WriteLine("Players Deck: {0}", game.GetPlayerCardsAsString());
     if (game.GameDraw)
     {
         Console.WriteLine("Game is a draw!");
     }
     else if (game.GameWon)
     {
         Console.WriteLine("You won this round!");
     }
     else
     {
         Console.WriteLine("You lost this round!");
     }
     Console.WriteLine("You have {0} left!", game.Money);
 }