diff --git a/Lingo/Game.cs b/Lingo/Game.cs index 9cb0eb9..334d756 100644 --- a/Lingo/Game.cs +++ b/Lingo/Game.cs @@ -10,14 +10,15 @@ public class Game private static int index = rnd.Next(1, Words.FiveLetterWords.Count); private static string solution = Words.FiveLetterWords[index]; private static bool exit = false; - public void validateFiveLetters(string solution) + public void validateFiveLetters(string solutionCheck) { - + exit = false; while (exit == false) { - if (solution.Length != 5) + if (solutionCheck.Length != 5) { index = rnd.Next(1, Words.FiveLetterWords.Count); + solution = Words.FiveLetterWords[index]; } else { @@ -26,21 +27,47 @@ public class Game } } + public void validateFiveLettersAttempt(string attemptCheck) + { + exit = false; + while (exit == false) + { + if (attemptCheck.Length != 5) + { + attempt = AnsiConsole.Ask("Your word is not exactly 5 letters. Try again."); + } + else + { + exit = true; + } + } + } + + public static string attempt = AnsiConsole.Ask("What is your [green]name[/]?"); private List attemptList; + private List solutionList; private void createCharList(string solution) { foreach (char c in solution) + { + solutionList.Add(c); + } + } + + private void createAttemptCharList(string attempt) + { + foreach (char c in attempt) { attemptList.Add(c); } } - public Game() { validateFiveLetters(solution); + validateFiveLettersAttempt(attempt); createCharList(solution); - + createAttemptCharList(attempt); } } \ No newline at end of file