Exemplo n.º 1
0
Arquivo: 2048.cs Projeto: knjz/2048
        static void Main(string[] args)
        {
            IGameEngine engine = GetGameEngine();
            IGameOptions options = new _2048Options();
            IStatefullBoard board = new Board();
            var colorizer = new TileColorizer();

            Console.BackgroundColor = ConsoleColor.White;
            PrintBoard(board, colorizer);

            IGame game2048 = new Game2048(engine, options, board);
            game2048.RepaintRequiredEvent += (o, e) => PrintBoard(e.Board, colorizer);
            game2048.Play();
            Console.WriteLine("Game over!");
            if (engine.IsAI() && board.StepsCount > options.MaxStepCount)
            {
                Console.WriteLine("Halt! {0} step limit reached!", options.MaxStepCount);
            }

            Console.ResetColor();
        }
Exemplo n.º 2
0
Arquivo: 2048.cs Projeto: sSlOlZz/2048
        static void Main(string[] args)
        {
            IGameEngine     engine    = GetGameEngine();
            IGameOptions    options   = new _2048Options();
            IStatefullBoard board     = new Board();
            var             colorizer = new TileColorizer();

            Console.BackgroundColor = ConsoleColor.White;
            PrintBoard(board, colorizer);

            IGame game2048 = new Game2048(engine, options, board);

            game2048.RepaintRequiredEvent += (o, e) => PrintBoard(e.Board, colorizer);
            game2048.Play();
            Console.WriteLine("Game over!");
            if (engine.IsAI() && board.StepsCount > options.MaxStepCount)
            {
                Console.WriteLine("Halt! {0} step limit reached!", options.MaxStepCount);
            }

            Console.ResetColor();
        }