Пример #1
0
        public bool MakeGuess(string word)
        {
            if (word == null)
            {
                throw new ArgumentNullException();
            }

            GameOver = true;
            gameStep = 6;
            return(GameResult = WordToGuess.ToString() == word);
        }
Пример #2
0
        public bool MakeGuess(char letter)
        {
            if (GuessedLetters.Contains(letter))
            {
                if (++gameStep > 6)
                {
                    GameOver   = true;
                    GameResult = false;
                    return(false);
                }
            }

            if (WordToGuess.ToString().Contains(letter))
            {
                GuessedLetters.Add(letter);

                if (MaskedWord() == WordToGuess.ToString())
                {
                    GameOver   = true;
                    GameResult = true;
                }

                return(true);
            }
            else
            {
                if (++gameStep > 6)
                {
                    GameOver   = true;
                    GameResult = false;
                    return(false);
                }
            }

            return(false);
        }
Пример #3
0
 //will print the (Coded) Word
 public override string ToString()
 {
     return(WordToGuess.ToString());
 }