コード例 #1
0
        //RouletteTable method is the first entry point from the Program.Main method.
        //Chip values are initialized to 500, and after setting the scene the app flow is transferred to the place bet function
        //When the game is considered over, if the user chooses to play again, they will be returned here
        public static void RouletteTable()
        {
            int initialChips = 500;

            Console.WriteLine(format + "You sit down at the sole Roulette table in the large hall.");
            Console.WriteLine(format + "The ambience draws you in, you hear jazz music somewhere in the distance.");
            Console.WriteLine(format + "The dealer, a blonde man of about 23, turns to face you.");
            Console.WriteLine(format + "'Welcome! Place your bet and spin the wheel.'");
            Console.WriteLine(format + "You start with 500 Chips.");
            //"The game ends when you have 0 chips, or 1000."); **Chip check functionality coming soon!**
            Console.WriteLine(format + lineBreak);
            Console.ReadLine();
            Gamble.PlaceBet(initialChips);
        }
コード例 #2
0
        //Simple user interaction method which provides oppurtunity for returning to the PlaceBet
        //Method or gracefully exiting the application
        //Any entry other than 1 or 2 will throw an exception
        public static void SpinAgain(int chips)
        {
            Console.WriteLine(format + lineBreak);
            Console.WriteLine(format + "Would you like to spin again?");
            Console.WriteLine(format + "Press 1 for Yes and 2 for No");

            int userinput = int.Parse(Console.ReadLine());

            if (userinput == 1)
            {
                Gamble.PlaceBet(chips);
            }
            else if (userinput == 2)
            {
                return;
            }
            else
            {
                throw new ArgumentException();
            }
        }