static void Main(string[] args) { bool keepPlaying = true; while (keepPlaying) { Console.Clear(); Hangman hangman = new Hangman(); keepPlaying = Validation.BoolValidation("\r\nKeep playing? (yes/no)"); } }
static void Main(string[] args) { Console.Clear(); Console.WriteLine("You have to complete the game within 60 seconds"); Hangman obj = new Hangman(); int returnVal = obj.AcceptCategory(); if (returnVal == 1) { //obj.StartGame(); Thread t = new Thread(new ThreadStart(obj.StartGame)); t.Start(); //Starting the new thread Thread.Sleep(60000); //Making the Main thread sleep for 90 Seconds try { t.Abort(); Console.WriteLine("Time Over"); }//Killing the new thread catch (ThreadAbortException e) { Console.WriteLine(e.Message); } } Console.ReadLine(); }
static void Main(string[] args) { Console.Clear(); Console.WriteLine("You have to complete the game within 60 seconds"); Hangman obj = new Hangman(); int returnVal = obj.AcceptCategory(); if (returnVal == 1) { //obj.StartGame(); Thread t = new Thread(new ThreadStart(obj.StartGame)); t.Start();//Starting the new thread Thread.Sleep(60000);//Making the Main thread sleep for 90 Seconds try { t.Abort(); Console.WriteLine("Time Over"); }//Killing the new thread catch (ThreadAbortException e) { Console.WriteLine(e.Message); } } Console.ReadLine(); }