Exemplo n.º 1
0
        public bool MakeGuess(string word)
        {
            if (word == null)
            {
                throw new ArgumentNullException();
            }

            GameOver = true;
            gameStep = 6;
            return(GameResult = WordToGuess.ToString() == word);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 //will print the (Coded) Word
 public override string ToString()
 {
     return(WordToGuess.ToString());
 }