This commit is contained in:
Jocelyn Hebert 2026-06-02 16:15:23 -03:00
commit 9e5490d42f
2 changed files with 19 additions and 19 deletions

View file

@ -4,49 +4,48 @@ using Spectre.Console;
namespace Lingo; namespace Lingo;
public class Attempt public class Game
{ {
static Random rnd = new Random(); static Random rnd = new Random();
public int Tries { get; private set; } public int Tries { get; private set; }
private static int unit = rnd.Next(1, Words.FiveLetterWords.Count); private static int unit = rnd.Next(1, Words.FiveLetterWords.Count);
public string Solution = Words.FiveLetterWords[unit]; public string Solution = Words.FiveLetterWords[unit];
public string trying; public string trying;
private void catchingLengthErrors(string solution) private void catchingLengthErrors(string solution)
{ {
while (solution.Length != 5) while (solution.Length != 5)
{ {
unit = rnd.Next(1, Words.FiveLetterWords.Count); unit = rnd.Next(1, Words.FiveLetterWords.Count);
solution = Words.FiveLetterWords[unit]; solution = Words.FiveLetterWords[unit];
} }
} }
public string lineOne = ""; private string lineOne = "";
public string lineTwo = ""; private string lineTwo = "";
public string lineThree = ""; private string lineThree = "";
public string lineFour = ""; private string lineFour = "";
public string lineFive = ""; private string lineFive = "";
public void GameTurn() public void GameTurn()
{ {
AnsiConsole.MarkupLine($"[blue]Attempt #{Tries}[/]"); AnsiConsole.MarkupLine($"[blue]Attempt #{Tries}[/]");
Console.ReadLine(); Console.ReadLine();
//Don't forget, we need big logicc here! //Don't forget, we need big logic here!
} }
public Attempt() public Game()
{ {
if (trying.Length == 5) if (trying.Length == 5)
{ {
Attempt attempt = new Attempt(); Game game = new Game();
while (attempt.Tries <= 5) while (game.Tries <= 5)
{ {
AnsiConsole.MarkupLine($"Attempt #{Tries}"); AnsiConsole.MarkupLine($"Attempt #{Tries}");
attempt.GameTurn(); game.GameTurn();
} }
} }
else else

View file

@ -26,6 +26,7 @@ class Program
switch (userSelection) switch (userSelection)
{ {
case "1. Play Lingo": case "1. Play Lingo":
Game attempt = new Game();
break; break;
case "2. Quit": case "2. Quit":