Added gui version and basic scorehandler
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using Memory.Logic;
|
||||
using Memory.Data;
|
||||
using Memory.Logic;
|
||||
|
||||
namespace Memory.Cmd
|
||||
{
|
||||
@ -6,24 +7,37 @@ namespace Memory.Cmd
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
Game game = new();
|
||||
Renderer renderer = new(game);
|
||||
while (!game.IsFinished())
|
||||
while (true)
|
||||
{
|
||||
renderer.Render();
|
||||
Console.Write("Enter card number: ");
|
||||
try
|
||||
Game game = new(new ScoreHandler());
|
||||
Renderer renderer = new(game);
|
||||
while (!game.IsFinished())
|
||||
{
|
||||
game.ClickCard(game.Cards[int.Parse(Console.ReadLine()!) - 1]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.WriteLine("Invalid card number given.");
|
||||
Console.ReadLine();
|
||||
renderer.Redraw();
|
||||
Console.Write("Enter card number: ");
|
||||
try
|
||||
{
|
||||
game.ClickCard(game.Cards[int.Parse(Console.ReadLine()!) - 1]);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Console.Write("Invalid card number given.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
Console.Clear();
|
||||
Console.Write("Game Finished. Do you want to play again? (Y/N): ");
|
||||
string? answer = Console.ReadLine();
|
||||
while (answer == null || (!answer.Equals("y", StringComparison.CurrentCultureIgnoreCase) && !answer.Equals("n", StringComparison.CurrentCultureIgnoreCase)))
|
||||
{
|
||||
Console.Write("Invalid answer.\nDo you want to play again? (Y/N): ");
|
||||
answer = Console.ReadLine();
|
||||
}
|
||||
if (answer.Equals("n", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
renderer.Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user