Initial
This commit is contained in:
commit
67ac9d68c5
6 changed files with 122 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
bin/
|
||||
obj/
|
||||
/packages/
|
||||
riderModule.iml
|
||||
/_ReSharper.Caches/
|
||||
16
Lingo.sln
Normal file
16
Lingo.sln
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lingo", "Lingo\Lingo.csproj", "{7C55B2BF-A35B-408C-A143-09E9C8D3F24F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7C55B2BF-A35B-408C-A143-09E9C8D3F24F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7C55B2BF-A35B-408C-A143-09E9C8D3F24F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7C55B2BF-A35B-408C-A143-09E9C8D3F24F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7C55B2BF-A35B-408C-A143-09E9C8D3F24F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
25
Lingo/Game.cs
Normal file
25
Lingo/Game.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
namespace Lingo;
|
||||
|
||||
public abstract class Game
|
||||
{
|
||||
public string Solution { get; }
|
||||
public int AttemptsRemaining { get; protected set; }
|
||||
public List<string> Guesses { get; protected set; } = new();
|
||||
public bool IsWon { get; protected set; }
|
||||
public bool IsLost { get; protected set; }
|
||||
|
||||
public abstract string EvaluateGuess(string guess);
|
||||
|
||||
public virtual bool MakeGuess(string guess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class LingoGame : Game
|
||||
{
|
||||
public override string EvaluateGuess(string guess)
|
||||
{
|
||||
return guess;
|
||||
}
|
||||
}
|
||||
14
Lingo/Lingo.csproj
Normal file
14
Lingo/Lingo.csproj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Spectre.Console" Version="0.55.3-alpha.0.18"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
45
Lingo/Program.cs
Normal file
45
Lingo/Program.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
namespace Lingo;
|
||||
|
||||
using Spectre.Console;
|
||||
|
||||
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":
|
||||
Console.WriteLine("Let's go! Press Any Key To Continue");
|
||||
Console.ReadLine();
|
||||
break;
|
||||
case "2. Quit":
|
||||
isRunning = false;
|
||||
break;
|
||||
}
|
||||
//This is where the Switch will be.
|
||||
} while (isRunning);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AnsiConsole.MarkupLine($"[red]Error:[/] {ex.Message}");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Lingo/Words.cs
Normal file
17
Lingo/Words.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
namespace Lingo;
|
||||
|
||||
public static class Words
|
||||
{
|
||||
public static readonly List<string> CommonFiveLetterWords = new List<string>
|
||||
{
|
||||
"about", "above", "actor", "adult", "after", "again", "agent", "agree", "ahead", "alarm", "album", "alert",
|
||||
"alike", "alive", "allow", "alone", "along", "alter", "among", "anger", "angle", "angry", "apart", "apple",
|
||||
"apply", "arena", "argue", "arise", "array", "arrow", "aside", "asset", "audio", "audit", "avoid", "award",
|
||||
"aware", "awful", "badly", "baker", "basic", "basis", "beach", "beard", "beast", "begin", "being", "below",
|
||||
"bench", "berry", "birth", "black", "blade", "blame", "blind", "block", "blood", "board", "boast", "bonus",
|
||||
"boost", "bound", "brain", "brand", "brave", "bread", "break", "breed", "brick", "bride", "brief", "bring",
|
||||
"broad", "broke", "brown", "brush", "buyer", "cabin", "cable", "camel", "canal", "candy", "cards", "carry",
|
||||
"cases", "catch", "cause", "chair", "chart", "chase", "cheap", "cheat", "check", "cheek", "cheer", "chess",
|
||||
"chest"
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue