Heavy modifications, OOP concepts.

This commit is contained in:
Jocelyn Hebert 2026-07-15 11:08:07 -03:00
commit a8927e4ed3
7 changed files with 5807 additions and 140 deletions

6
Lingo/ChooseWord.cs Normal file
View file

@ -0,0 +1,6 @@
namespace Lingo;
public class ChooseWord
{
}

View file

@ -1,56 +0,0 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.JavaScript;
using Spectre.Console;
namespace Lingo;
public class Game
{
static Random rnd = new Random();
public int Tries { get; private set; }
private static int unit = rnd.Next(1, Words.FiveLetterWords.Count);
public string Solution = Words.FiveLetterWords[unit];
public string trying;
private void catchingLengthErrors(string solution)
{
while (solution.Length != 5)
{
unit = rnd.Next(1, Words.FiveLetterWords.Count);
solution = Words.FiveLetterWords[unit];
}
}
private string lineOne = "";
private string lineTwo = "";
private string lineThree = "";
private string lineFour = "";
private string lineFive = "";
public void GameTurn()
{
AnsiConsole.MarkupLine($"[blue]Attempt #{Tries}[/]");
Console.ReadLine();
//Don't forget, we need big logic here!
}
public Game()
{
if (trying.Length == 5)
{
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![/]");
}
}
}

21
Lingo/GameData.cs Normal file
View file

@ -0,0 +1,21 @@
namespace Lingo;
public class GameData
{
public bool GamePlaying { get; private set; }
public bool IsWon { get; private set; }
public bool IsGameOver { get; private set; }
public string CurrentTry { get; private set; }
public string Answer { get; private set; }
public GameData()
{
GamePlaying = true;
IsWon = false;
IsGameOver = false;
CurrentTry = "";
Answer = "";
}
}

22
Lingo/PlayGame.cs Normal file
View file

@ -0,0 +1,22 @@
namespace Lingo;
using System;
using Spectre.Console;
public class PlayGame
{
public PlayGame()
{
GameData game = new GameData();
while (game.GamePlaying)
{
AnsiConsole.MarkupLine($"[white on black]Enter your guess[/]");
public string CurrentBoard = $"[white on black]Enter your guess[/]\n";
}
}
}

View file

@ -6,39 +6,6 @@ class Program
{
static void Main(string[] args)
{
try
{
bool isRunning = true;
do
{
AnsiConsole.Clear();
string userSelection = AnsiConsole.Prompt(
new SelectionPrompt<string>()
.Title("Choose play or quit ")
.AddChoices
(
"1. Play Lingo",
"2. Quit"
)
);
switch (userSelection)
{
case "1. Play Lingo":
Game attempt = new Game();
break;
case "2. Quit":
isRunning = false;
break;
}
} while (isRunning);
}
catch (Exception ex)
{
AnsiConsole.MarkupLine($"[red]Error:[/] {ex.Message}");
Console.ReadLine();
}
AnsiConsole.MarkupLine($"[white on red]Enter your guess[/]");
}
}

View file

@ -1,50 +0,0 @@
namespace Lingo;
public static class Words
{
public static readonly List<string> FiveLetterWords = new List<string>
{
"joust", "swamp", "glint", "prawn", "chide", "stomp", "fleck", "groan",
"birch", "thrum", "slunk", "brave", "chops", "twirl", "plank", "snore", "draft", "gloom", "wharf", "spunk",
"cling", "broth", "flint", "grove", "scamp", "dwarf", "prism", "cleft", "stoic", "blurt", "frisk", "swoon",
"grasp", "tryst", "chomp", "pleat", "sniff", "glare", "whelp", "sprig", "clamp", "brood", "floss", "gripe",
"scalp", "stunt", "bliss", "crisp", "joust", "swamp", "glint", "prawn", "chide", "stomp", "fleck", "groan",
"birch", "thrum", "slunk", "brave", "chops", "twirl", "plank", "snore", "draft", "gloom", "wharf", "spunk",
"cling", "broth", "flint", "grove", "scamp", "dwarf", "prism", "cleft", "stoic", "blurt", "frisk", "swoon",
"grasp", "tryst", "chomp", "pleat", "glyph", "tramp", "swirl", "clunk", "broil", "flare", "gruff", "snout",
"plods", "chimp", "straw", "blond", "crimp", "joust", "whelk", "sprat", "clasp", "brunt", "flunk", "graze",
"stomp", "bloke", "crest", "jumpy", "swath", "glean", "prowl", "chasm", "thong", "slant", "brawl", "chomp",
"tweed", "plumb", "snare", "drool", "gloat", "whirl", "spiel", "clove", "brisk", "flown", "grout", "scald",
"stoop", "blunt", "croak", "jilts", "swipe", "gleam", "prong", "chewy", "throb", "slump", "brawn", "clops",
"twist", "pluck", "snuck", "droop", "glove", "wring", "spout", "clown", "brood", "fleck", "growl", "scalp",
"stoic", "blaze", "creed", "joker", "swung", "glide", "prude", "churn", "thump", "slung", "brine", "cleft",
"twins", "plume", "snide", "dross", "gloss", "wrung", "spree", "cluck", "brook", "flout", "gruel", "scoff",
"stomp", "blown", "crept", "julep", "swore", "glint", "prawn", "chunk", "thwart", "slosh", "graft", "twang",
"swoop", "clamp", "broil", "flank", "grubs", "snobs", "plonk", "chive", "strep", "bland", "crisp", "jowls",
"whelp", "sprat", "clasp", "brunt", "flunk", "graze", "stalk", "bloke", "crest", "jumps", "swath", "glean",
"prowl", "chasm", "thong", "slant", "brawl", "chomp", "tweed", "plumb", "snare", "drool", "gloat", "whirl",
"spiel", "clove", "brisk", "flown", "grout", "scald", "stoop", "blunt", "croak", "jilts", "swipe", "gleam",
"prong", "chewy", "throb", "slump", "brawn", "clops", "twist", "pluck", "snuck", "droop", "glove", "wring",
"spout", "clown", "broom", "fleck", "growl", "scalp", "stoic", "blaze", "creed", "joker", "swung", "glide",
"prude", "churn", "thump", "slung", "brine", "cleft", "twins", "plume", "snide", "dross", "gloss", "wrung",
"spree", "cluck", "brook", "flout", "gruel", "scoff", "stomp", "blown", "crept", "julep", "swore", "glint",
"prawn", "chunk", "slash", "slosh", "gavel", "twirl", "swank", "clunk", "braid", "flare", "gruff", "snout",
"plods", "chimp", "straw", "blond", "crimp", "joust", "whelk", "sprig", "grasp", "brunt", "flunk", "graze",
"stomp", "bloke", "crest", "jumpy", "swath", "gleam", "prowl", "chasm", "thong", "slant", "brawl", "chomp",
"tweed", "plumb", "snare", "drool", "gloat", "whirl", "spiel", "clove", "brisk", "flown", "grout", "scald",
"stoop", "blunt", "croak", "jilts", "swipe", "gleam", "prong", "chewy", "throb", "slump", "brawn", "clops",
"twist", "pluck", "snuck", "droop", "glove", "wring", "spout", "clown", "brood", "fleck", "growl", "scalp",
"stoic", "blaze", "creed", "joker", "swung", "glide", "prude", "churn", "thump", "slung", "brine", "cleft",
"twins", "plume", "snide", "dross", "gloss", "wrung", "spree", "cluck", "brook", "flout", "gruel", "scoff",
"stomp", "blown", "crept", "julep", "swore", "glint", "prawn", "chunk", "thwat", "slosh", "graft", "tramp",
"swoop", "clamp", "broil", "flank", "grubs", "snobs", "plonk", "chive", "strep", "bland", "crisp", "jowls",
"whelp", "sprat", "clasp", "brunt", "flunk", "graze", "stalk", "bloke", "crest", "jumps", "swath", "glean",
"prowl", "chasm", "thong", "slant", "brawl", "chomp", "tweed", "plumb", "snare", "drool", "gloat", "whirl",
"spiel", "clove", "brisk", "flown", "grout", "scald", "stoop", "blunt", "croak", "jilts", "swipe", "gleam",
"prong", "chewy", "throb", "slump", "brawn", "clops", "twist", "pluck", "snuck", "droop", "glove", "wring",
"spout", "clown", "broom", "fleck", "growl", "scalp", "stoic", "blaze", "creed", "joker", "swung", "glide",
"prude", "churn", "thump", "slung", "brine", "cleft", "twins", "plume", "snide", "dross", "gloss", "wrung",
"spree", "cluck", "brook", "flout", "gruel", "scoff", "stomp", "blown", "crept", "julep", "swore", "glint",
"prawn", "chunk", "slash", "slosh"
};
}

5757
Lingo/words.txt Normal file

File diff suppressed because it is too large Load diff