static void Main(string[] args) { //Console.SetWindowSize(Console.LargestWindowWidth - 3, Console.LargestWindowHeight - 3); // creating custom AI client var bot = new Mastermind(ServerUrl); // starting thread with playing game Task.Run(() => bot.Play()); // waiting for any key Console.ReadKey(); // on any key - asking AI client to stop. bot.InitiateExit(); }