Compare commits
3 commits
9e5490d42f
...
e2bcf46be7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2bcf46be7 | ||
|
|
bb0272132a | ||
|
|
38500aebfb |
6 changed files with 72 additions and 38 deletions
15
.idea/.idea.Lingo/.idea/.gitignore
generated
vendored
Normal file
15
.idea/.idea.Lingo/.idea/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# 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
|
||||||
4
.idea/.idea.Lingo/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.Lingo/.idea/encodings.xml
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
8
.idea/.idea.Lingo/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.Lingo/.idea/indexLayout.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.Lingo/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.Lingo/.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -1,56 +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 Game
|
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];
|
{
|
||||||
|
index = rnd.Next(1, Words.FiveLetterWords.Count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exit = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string lineOne = "";
|
private List<char> attemptList;
|
||||||
private string lineTwo = "";
|
|
||||||
private string lineThree = "";
|
|
||||||
private string lineFour = "";
|
|
||||||
private string lineFive = "";
|
|
||||||
|
|
||||||
public void GameTurn()
|
private void createCharList(string solution)
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine($"[blue]Attempt #{Tries}[/]");
|
foreach (char c in solution)
|
||||||
Console.ReadLine();
|
{
|
||||||
|
attemptList.Add(c);
|
||||||
//Don't forget, we need big logic here!
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Game()
|
public Game()
|
||||||
{
|
{
|
||||||
if (trying.Length == 5)
|
validateFiveLetters(solution);
|
||||||
{
|
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![/]");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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