コード例 #1
0
ファイル: Program.cs プロジェクト: pareion/TonsOfFun
 static void Main(string[] args)
 {
     bool playing = true;
     DealCards DC = new DealCards();
     while (playing)
     {
         try_again:
         Console.WriteLine("Press 1 to start playing");
         Console.WriteLine("Press 2 to stop playing");
         Console.WriteLine();
         Console.WriteLine("*** SCORE ***");
         Console.WriteLine("Player   Computer");
         string[] wins = DC.winners().Split(';');
         Console.WriteLine(wins[0]+"           "+ wins[1]);
         int choice = 0;
         try
         {
             choice = int.Parse(Console.ReadLine());
         }
         catch (Exception)
         {
             goto try_again;
         }
         switch (choice)
         {
             case 1:
                 DC.Deal();
                 break;
             case 2:
                 playing = false;
                 break;
         }
     }
 }
コード例 #2
0
        static void Main(string[] args)
        {
            DealCards dc   = new DealCards();
            bool      play = true;

            while (play)
            {
                dc.deal();
                char select = ' ';
                while (select != 'Y' && select != 'N')
                {
                    Console.WriteLine("Would you like to play again? If yes press 'Y' else press 'N'.");
                    select = Convert.ToChar(Console.ReadLine().ToUpper());

                    if (select.Equals('Y'))
                    {
                        play = true;
                    }
                    else if (select.Equals('N'))
                    {
                        play = false;
                    }
                    else
                    {
                        Console.WriteLine("Invalid selection. Try again. \n");
                    }
                }
            }
            Console.WriteLine("Thank you for playing. Press any key to exit.");
            Console.ReadLine();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: nielsen192/PokerGame
        public void Run()
        {
            Console.SetWindowSize(65, 40);
            // remove scroll bars by setting the buffer to the actual window size
            Console.BufferWidth = 65;
            Console.BufferHeight = 40;
            Console.BackgroundColor = ConsoleColor.Gray;
            Console.Title = "Poker Game";
            DealCards dc = new DealCards();
            bool quit = false;

            while (!quit)
            {
                dc.Deal();

                char selection = ' ';
                while (!selection.Equals('Y') && !selection.Equals('N'))
                {
                    Console.WriteLine("Play again? Y-N");
                    selection = Convert.ToChar(Console.ReadLine().ToUpper());

                    if (selection.Equals('Y'))
                        quit = false;
                    else if (selection.Equals('N'))
                        quit = true;
                    else
                        Console.WriteLine("Invalid Selection. Try again");
                }
            }

            Console.ReadKey();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Console.SetWindowSize(65, 40);
            //rremove scroll bars by setting the buffer to the actual window size
            Console.BufferWidth  = 65;
            Console.BufferHeight = 40;
            //Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.DarkGray;
            Console.Title           = "Poker Game";
            DealCards dc   = new DealCards();
            bool      quit = false;

            while (!quit)
            {
                dc.Deal();

                char selection = ' ';
                while (!selection.Equals('Y') && !selection.Equals('N'))
                {
                    Console.WriteLine("Play again? Y-N");
                    selection = Convert.ToChar(Console.ReadLine().ToUpper());

                    if (selection.Equals('Y'))
                    {
                        quit = false;
                    }
                    else if (selection.Equals('N'))
                    {
                        quit = true;
                    }
                    else
                    {
                        Console.WriteLine("Invalid Selection. Try again!");
                    }
                }
            }
            Console.ReadKey();
        }