From 09436ff686e2d346d9a75d6ff5ed6d677cb99d63 Mon Sep 17 00:00:00 2001 From: epvanhouten Date: Sat, 27 Feb 2021 19:08:56 -0600 Subject: [PATCH] Add a bailout Forcing a SIGKILL is bad form, give some UI for playing again or bailing. --- 51 Hurkle/csharp/src/hurkle/Program.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/51 Hurkle/csharp/src/hurkle/Program.cs b/51 Hurkle/csharp/src/hurkle/Program.cs index 447fa547..4c4040b7 100644 --- a/51 Hurkle/csharp/src/hurkle/Program.cs +++ b/51 Hurkle/csharp/src/hurkle/Program.cs @@ -45,9 +45,18 @@ namespace hurkle { hurkle.PlayGame(); - Console.WriteLine(); - Console.WriteLine("LET'S PLAY AGAIN. HURKLE IS HIDING"); - Console.WriteLine(); + Console.WriteLine("PLAY AGAIN? (Y)ES/(N)O"); + var playAgainResponse = Console.ReadLine(); + if(playAgainResponse.Trim().StartsWith("y", StringComparison.InvariantCultureIgnoreCase)) + { + Console.WriteLine(); + Console.WriteLine("LET'S PLAY AGAIN. HURKLE IS HIDING"); + Console.WriteLine(); + }else{ + Console.WriteLine("THANKS FOR PLAYING!"); + break; + } + } } }