Exemplo n.º 1
0
        static void Main(string[] args)
        {
            bool keepPlaying = false;

            Console.WriteLine("Please enter a word");
            string userInput = Console.ReadLine();

            Hangman hangman = new Hangman(userInput);

            Console.WriteLine(hangman.buildBoard());

            while (!keepPlaying)
            {
                Console.WriteLine("Please enter a single letter guess");
                string userGuess = Console.ReadLine();
                bool   result    = hangman.guessedLetterCorrectly(userGuess[0]);
                char   guess     = userGuess[0];
                hangman.acceptUserGuess(guess);
                Console.WriteLine(hangman.updateBoard());
                keepPlaying = hangman.solvedPuzzle();
            }
            Console.WriteLine("Congrats, you won!");

            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            bool keepPlaying = false;
            Console.WriteLine("Please enter a word");
            string userInput = Console.ReadLine();

            Hangman hangman = new Hangman(userInput);
            Console.WriteLine(hangman.buildBoard());

            while (!keepPlaying)
            {
                Console.WriteLine("Please enter a single letter guess");
                string userGuess = Console.ReadLine();
                bool result = hangman.guessedLetterCorrectly(userGuess[0]);
                char guess = userGuess[0];
                hangman.acceptUserGuess(guess);
                Console.WriteLine(hangman.updateBoard());
                keepPlaying = hangman.solvedPuzzle();
            }
            Console.WriteLine("Congrats, you won!");

            Console.ReadLine();
        }