Exemplo n.º 1
0
        static void CompleteLoop()
        {
            int wins  = 0;
            int games = 0;
            var words = new WordPicker();

            do
            {
                games++;
                if (GameLoop(words.Next()))
                {
                    wins++;
                }
                Console.WriteLine();
                Console.WriteLine($"You have won {wins} game out of {games} played.");
                Console.WriteLine("Play again? (y/n)");
            } while (words.HasNext && ConfirmYN());
            Console.Clear();
            if (words.HasNext == false)
            {
                Console.WriteLine("Out of words...");
                Console.WriteLine($"You won {wins} game out of {games} played.");
            }
            Console.WriteLine("Thank you for playing!");
        }
Exemplo n.º 2
0
        public void newGame()
        {
            seconds    = 10 * 60;
            wordPicker = new WordPicker();
            String word = wordPicker.pickNextWord();

            hangman           = new HangmanWord(word);
            wordGuess.Text    = hangman.refreshGuessed();
            triedLetters.Text = hangman.refreshTotalLetters();
            tbGuess.Clear();
            pbTimer.Minimum        = 0;
            pbTimer.Maximum        = 10 * 60;
            pbTimer.Value          = 10 * 60;
            pbWrongCounter.Minimum = 0;
            pbWrongCounter.Maximum = HangmanWord.MAX_GUESSES;
            pbWrongCounter.Value   = 0;
            timerTime.Start();
        }