예제 #1
0
        public static int GetPowerballNumber()
        {
            Console.Clear();
            Prompt.PowerballInstructions();
            bool validInput = false;
            int  number     = 0;

            while (!validInput)
            {
                bool validOutput = false;
                int  output      = 0;
                while (!validOutput)
                {
                    Console.Write("Enter a number for your powerball : ");
                    string input = Console.ReadLine();
                    if (input.Equals("quickpick", StringComparison.CurrentCultureIgnoreCase))
                    {
                        number      = QuickPick.RandomPowerball();
                        validInput  = true;
                        validOutput = true;
                    }
                    else if (InputToInt(input))
                    {
                        output      = int.Parse(input);
                        validOutput = true;
                    }
                    else
                    {
                        Console.Clear();
                        Prompt.PowerballInstructions();
                        Console.WriteLine("That was not a number!");
                    }
                }
                if (Validate.ValidPowerballRange(output))
                {
                    number     = output;
                    validInput = true;
                }
                else
                {
                    Console.Clear();
                    Prompt.PowerballInstructions();
                    Console.WriteLine("That was not a number from 1 to 26!");
                }
            }
            return(number);
        }
예제 #2
0
        public static Pick QuickPickLickitySplit(string name)
        {
            List <int> balls = new List <int>();

            balls.Add(QuickPick.RandomBall());
            PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 1);
            PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 2);
            PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 3);
            PickBalls.QuickpickUntilRight(balls, QuickPick.RandomBall() + 100, 4);

            Pick pick = new Pick();

            pick.Name       = name;
            pick.FirstBall  = balls[0];
            pick.SecondBall = balls[1];
            pick.ThirdBall  = balls[2];
            pick.FourthBall = balls[3];
            pick.FifthBall  = balls[4];
            pick.PowerBall  = QuickPick.RandomPowerball();

            return(pick);
        }