44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using Memory.Data;
|
|
using Memory.Logic;
|
|
|
|
namespace Memory.Cmd
|
|
{
|
|
internal class Program
|
|
{
|
|
static void Main()
|
|
{
|
|
while (true)
|
|
{
|
|
Game game = new(new ScoreHandler());
|
|
Renderer renderer = new(game);
|
|
while (!game.IsFinished())
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|