Esempio n. 1
0
        public int GetUserGameSelection()
        {
            var gameSelection = Console.ReadLine();

            var validInput = UserInputValidation.GameSelectionCheck(gameSelection);

            if (!validInput)
            {
                Console.WriteLine("Please enter a valid number, try again:");
                return(GetUserGameSelection());
            }

            return(int.Parse(gameSelection));
        }
Esempio n. 2
0
        private static void UserDefinedGame(string gameSelection)
        {
            var validInput = UserInputValidation.GameSelectionCheck(gameSelection);

            if (!validInput)
            {
                Console.WriteLine("Invalid game selection");
            }
            else
            {
                var game       = new Game();
                var gameChoice = game.Start(int.Parse(gameSelection));

                Console.WriteLine(gameChoice.Play());
            }
        }