示例#1
0
        static void Main(string[] args)
        {
            //Create a new UI to initialize the game
            UI ui = new UI();

            //Print the welcome message and ask user if they want to play
            Console.Write(ui.DrawUI());

            //Read response, if the user wants to play
            bool startGame = Console.ReadLine() == "ja" ? true : false;

            //initialize a new game
            GuessNumber theGame = new GuessNumber(startGame);

            //start the game if the user wants to
            theGame.PlayGame();
        }
示例#2
0
        private void NewGamePrompt()
        {
            Console.WriteLine("Do you want to play? <y/n>");
            string answer = Console.ReadLine().ToLower();

            switch (answer)
            {
            case  "y":
                GuessNumber guessNumber = new GuessNumber(true);
                break;

            case "n":
                Console.WriteLine("Maybe another time. BYE!");
                break;

            default:
                NewGamePrompt();
                break;
            }
        }