Example #1
0
File: 2048.cs Project: knjz/2048
 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;
 }
Example #2
0
File: 2048.cs Project: sSlOlZz/2048
        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);
        }