static IGameEngine GetGameEngine() { IGameEngine engine = null; while (engine == null) { Console.Clear(); Console.WriteLine("Select mode:"); Console.WriteLine("1. User game"); Console.WriteLine("2. AI game"); var key = Console.ReadKey(true).KeyChar.ToString(); if (key == "1") engine = new ConsoleUserEngine(); if (key == "2") engine = new AINaiveEngine(); } return engine; }
static IGameEngine GetGameEngine() { IGameEngine engine = null; while (engine == null) { Console.Clear(); Console.WriteLine("Select mode:"); Console.WriteLine("1. User game"); Console.WriteLine("2. AI game"); var key = Console.ReadKey(true).KeyChar.ToString(); if (key == "1") { engine = new ConsoleUserEngine(); } if (key == "2") { engine = new AINaiveEngine(); } } return(engine); }