Esempio n. 1
0
        static void Main(string[] args)
        {
            var defaultSettings = SettingsHelper.GetSettings(args);

            if (defaultSettings == null)
            {
                Console.WriteLine("Oops! :(  The settings file could not be loaded!");
            }
            try
            {
                var board         = MapperHelper.Mapper.Map <DefaultBoard>(defaultSettings.BoardSettings);
                var player        = new Player(board);
                var defaultSound  = new DefaultSound();
                var defaultEngine = new DefaultEngine(player, defaultSettings, defaultSound);
                defaultEngine.Notify(Enums.EngineEvent.Play);
                var opt = GetMenu(defaultEngine);
                while (opt != EXIT)
                {
                    var engineOperation = EngineOperationHelper.From(opt);
                    if (engineOperation.HasValue)
                    {
                        defaultEngine.Do(engineOperation.Value);
                    }
                    opt = GetMenu(defaultEngine);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Oops! :(  there was a little problem during the game! please restart the game.");
                Console.WriteLine($"ERROR => {ex}");
            }
            Console.WriteLine("The end!");
        }