예제 #1
0
        static void Main(string[] args)
        {
            bool playAgain = true;

            while (playAgain)
            {
                CheeseNibbler cheese = new CheeseNibbler();
                cheese.PlayGame();

                Console.WriteLine("Do you wanna play again? (Y/N)");
                ConsoleKeyInfo input = Console.ReadKey();
                if (input.Key != ConsoleKey.Y)
                {
                    playAgain = false;
                }
            }

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            bool notQuit = true;

            do
            {
                CheeseNibbler game = new CheeseNibbler();
                game.PlayGame();
                Console.Write("Do you want to play again? (y/n)");
                string result = Console.ReadLine();
                result = result.ToLower();
                if (result == "n" || result == "no")
                {
                    notQuit = false;
                }
                if (result.Contains("no"))
                {
                    notQuit = false;
                }
                game.Cats.Clear();
            } while (notQuit);
        }