New logic added, June 3, 2026

This commit is contained in:
Jocelyn Hebert 2026-06-03 16:52:00 -03:00
commit 487912116e

View file

@ -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<string>("Your word is not exactly 5 letters. Try again.");
}
else
{
exit = true;
}
}
}
public static string attempt = AnsiConsole.Ask<string>("What is your [green]name[/]?");
private List<char> attemptList;
private List<char> 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);
}
}