예제 #1
0
        public int CountTries(GuessingGame gg)
        {
            GuessQuality output = GuessQuality.Start;
            int          tries  = 0;

            while (output != GuessQuality.Match)
            {
                tries++;
                int guess = g.GenerateGuess();
                output      = gg.MakeGuess(guess);
                g.LastGuess = output;
            }

            return(tries);
        }
예제 #2
0
        public void PlayGame()
        {
            GuessQuality output = GuessQuality.TooLow;

            while (output != GuessQuality.Match)
            {
                GuessingGame gg = new GuessingGame();
                Console.WriteLine("Please input a number between 1 and 100:");
                int input = int.Parse(Console.ReadLine());
                output = gg.MakeGuess(input);
                Console.WriteLine(output);
                if (output == GuessQuality.Match)
                {
                    Console.WriteLine("You win!!!");
                }
            }
        }