示例#1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Type b to play Blackjack, p to play Poker, any other key to quit.");

            var userResponse = Console.ReadLine();

            switch (userResponse)
            {
            case "b":
                BlackjackGame.Play();
                break;

            case "p":
                PokerGame.Play();
                break;
            }
        }
        // methods
        public static void Play()
        {
            string playAgain;

            do
            {
                Console.Clear();
                Console.WriteLine("RESULTS:");

                var game = new PokerGame("you", "computer");
                game.ShuffleDeck();

                game.DealCards(game.You, 5);
                game.DealCards(game.Them, 5);
                game.PrintResults();

                playAgain = Console.ReadLine();
            } while (!string.IsNullOrEmpty(playAgain) && playAgain.Substring(0, 1).ToLower() == "y");
        }
		// methods
		public static void Play()
		{
			string playAgain;

			do
			{
				Console.Clear();
				Console.WriteLine("RESULTS:");

				var game = new PokerGame("you", "computer");
				game.ShuffleDeck();

				game.DealCards(game.You, 5);
				game.DealCards(game.Them, 5);
				game.PrintResults();

				playAgain = Console.ReadLine();

			} while (!string.IsNullOrEmpty(playAgain) && playAgain.Substring(0, 1).ToLower() == "y");
		}