Almost started over, June 3 2026
This commit is contained in:
parent
9932c3bede
commit
38500aebfb
2 changed files with 42 additions and 42 deletions
|
|
@ -1,57 +1,46 @@
|
||||||
using System.Runtime.CompilerServices;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
using System.Runtime.InteropServices.JavaScript;
|
using System.Security.Cryptography;
|
||||||
using Spectre.Console;
|
using Spectre.Console;
|
||||||
|
|
||||||
namespace Lingo;
|
namespace Lingo;
|
||||||
|
|
||||||
public class Attempt
|
public class Game
|
||||||
{
|
{
|
||||||
|
private int count = 0;
|
||||||
static Random rnd = new Random();
|
static Random rnd = new Random();
|
||||||
public int Tries { get; private set; }
|
private static int index = rnd.Next(1, Words.FiveLetterWords.Count);
|
||||||
|
private static string solution = Words.FiveLetterWords[index];
|
||||||
private static int unit = rnd.Next(1, Words.FiveLetterWords.Count);
|
private static bool exit = false;
|
||||||
public string Solution = Words.FiveLetterWords[unit];
|
public void validateFiveLetters(string solution)
|
||||||
|
|
||||||
public string trying;
|
|
||||||
|
|
||||||
private void catchingLengthErrors(string solution)
|
|
||||||
{
|
{
|
||||||
while (solution.Length != 5)
|
|
||||||
|
while (exit == false)
|
||||||
{
|
{
|
||||||
unit = rnd.Next(1, Words.FiveLetterWords.Count);
|
if (solution.Length != 5)
|
||||||
solution = Words.FiveLetterWords[unit];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string lineOne = "";
|
|
||||||
public string lineTwo = "";
|
|
||||||
public string lineThree = "";
|
|
||||||
public string lineFour = "";
|
|
||||||
public string lineFive = "";
|
|
||||||
|
|
||||||
public void GameTurn()
|
|
||||||
{
|
|
||||||
AnsiConsole.MarkupLine($"[blue]Attempt #{Tries}[/]");
|
|
||||||
Console.ReadLine();
|
|
||||||
|
|
||||||
//Don't forget, we need big logicc here!
|
|
||||||
}
|
|
||||||
|
|
||||||
public Attempt()
|
|
||||||
{
|
|
||||||
|
|
||||||
if (trying.Length == 5)
|
|
||||||
{
|
|
||||||
Attempt attempt = new Attempt();
|
|
||||||
while (attempt.Tries <= 5)
|
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine($"Attempt #{Tries}");
|
index = rnd.Next(1, Words.FiveLetterWords.Count);
|
||||||
attempt.GameTurn();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
private List<char> attemptList;
|
||||||
|
|
||||||
|
private void createCharList(string solution)
|
||||||
|
{
|
||||||
|
foreach (char c in solution)
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine($"[red]Please enter a try that has 5 letters only![/]");
|
attemptList.Add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Game()
|
||||||
|
{
|
||||||
|
validateFiveLetters(solution);
|
||||||
|
createCharList(solution);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
11
Lingo/Play.cs
Normal file
11
Lingo/Play.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace Lingo;
|
||||||
|
|
||||||
|
public class Play
|
||||||
|
{
|
||||||
|
public Play()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int I { get; private set; }
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue