Compare commits

..

No commits in common. "e2bcf46be73d7990940f0eff1e37e8ff466c8ce7" and "9e5490d42f3f6e67691eed2326803a41e0874d55" have entirely different histories.

6 changed files with 38 additions and 72 deletions

15
.idea/.idea.Lingo/.idea/.gitignore generated vendored
View file

@ -1,15 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/.idea.Lingo.iml
/modules.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -1,46 +1,56 @@
using System.Reflection.Metadata.Ecma335; using System.Runtime.CompilerServices;
using System.Security.Cryptography; using System.Runtime.InteropServices.JavaScript;
using Spectre.Console; using Spectre.Console;
namespace Lingo; namespace Lingo;
public class Game public class Game
{ {
private int count = 0;
static Random rnd = new Random(); static Random rnd = new Random();
private static int index = rnd.Next(1, Words.FiveLetterWords.Count); public int Tries { get; private set; }
private static string solution = Words.FiveLetterWords[index];
private static bool exit = false; private static int unit = rnd.Next(1, Words.FiveLetterWords.Count);
public void validateFiveLetters(string solution) public string Solution = Words.FiveLetterWords[unit];
public string trying;
private void catchingLengthErrors(string solution)
{ {
while (solution.Length != 5)
while (exit == false)
{ {
if (solution.Length != 5) unit = rnd.Next(1, Words.FiveLetterWords.Count);
{ solution = Words.FiveLetterWords[unit];
index = rnd.Next(1, Words.FiveLetterWords.Count);
}
else
{
exit = true;
}
} }
} }
private List<char> attemptList; private string lineOne = "";
private string lineTwo = "";
private string lineThree = "";
private string lineFour = "";
private string lineFive = "";
private void createCharList(string solution) public void GameTurn()
{ {
foreach (char c in solution) AnsiConsole.MarkupLine($"[blue]Attempt #{Tries}[/]");
{ Console.ReadLine();
attemptList.Add(c);
} //Don't forget, we need big logic here!
} }
public Game() public Game()
{ {
validateFiveLetters(solution); if (trying.Length == 5)
createCharList(solution); {
Game game = new Game();
while (game.Tries <= 5)
{
AnsiConsole.MarkupLine($"Attempt #{Tries}");
game.GameTurn();
}
}
else
{
AnsiConsole.MarkupLine($"[red]Please enter a try that has 5 letters only![/]");
}
} }
} }

View file

@ -1,11 +0,0 @@
namespace Lingo;
public class Play
{
public Play()
{
}
public int I { get; private set; }
}