Finished scoring system and started tests
This commit is contained in:
@ -7,36 +7,28 @@ namespace Memory.Cmd
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
string name = CmdGame.GetPlayerName();
|
||||
while (true)
|
||||
{
|
||||
Game game = new(new ScoreHandler());
|
||||
Renderer renderer = new(game);
|
||||
Game game = new(new ScoreHandler(), name);
|
||||
CmdGame cmdGame = new(game);
|
||||
while (!game.IsFinished())
|
||||
{
|
||||
renderer.Redraw();
|
||||
cmdGame.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();
|
||||
}
|
||||
catch (Exception) {}
|
||||
}
|
||||
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))
|
||||
cmdGame.WriteScores();
|
||||
if (!CmdGame.ShouldReplay())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user