Beispiel #1
0
        public void Guess(string letter)
        {
            letter = letter.ToUpper();

            // is it a valid guess? game still going, letter not guessed before?
            if (!IsValidGuess(letter))
            {
                return;
            }

            // if letter isn't in word, then increase the number of incorrect guesses
            if (!WordToGuess.ToUpper().Contains(letter))
            {
                NrOfIncorrectGuesses++;
            }

            GuessedLetters.Add(letter);

            // has the word been solved?
            if (HasWordBeenGuessed())
            {
                WordGuessed = true;
            }
        }