Exemplo n.º 1
0
Arquivo: 2048.cs Projeto: 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;
 }
Exemplo n.º 2
0
Arquivo: 2048.cs Projeto: 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);
        }