Example #1
0
        public void Start()
        {
            string[]       words     = ReadWords();
            string         lingoWord = ChooseWord(words);
            LingoGameLogic lingoGame = new LingoGameLogic();

            lingoGame.SetLingoWord(lingoWord);
            PlayLingo(lingoGame);
        }
Example #2
0
        public void PlayLingo(LingoGameLogic lingoGame)
        {
            int attemptsLeft = 5;
            int wordLength   = lingoGame.lingoWord.Length;

            lingoGame.CheckWord(Console.ReadLine());

            while (attemptsLeft > 0 && !lingoGame.GuessedWord())
            {
                lingoGame.playerWord = ReadPlayerWord(wordLength);
                attemptsLeft--;
                DisplayResults(lingoGame);
            }
        }
Example #3
0
        public void DisplayResults(LingoGameLogic lingoGame)
        {
            for (int i = 0; i < lingoGame.playerWord.Length - 1; i++)
            {
                if (lingoGame.letterResults[i] == LetterStateEnum.Correct)
                {
                    Console.BackgroundColor = ConsoleColor.DarkGreen;
                }
                else if (lingoGame.letterResults[i] == LetterStateEnum.WrongPosition)
                {
                    Console.BackgroundColor = ConsoleColor.DarkYellow;
                }
                Console.Write(lingoGame.playerWord[i]);

                Console.ResetColor();
            }
        }