public void Perform(CommandContext context)
        {
            if (!_gameSettings.CurrentGame?.InProgress ?? true)
            {
                context.AddError("Cannot continue the finished game");
                return;
            }

            var game = _gameSettings.CurrentGame.Game;

            game.Update();
            OutputMap(game.Map);
        }
        public void Perform(CommandContext context)
        {
            if (_gameSettings.StartMap == null)
            {
                context.AddError("Select map first");
                return;
            }

            _gameSettings.CurrentGame = new GameContext
            {
                Game       = new Game(_gameSettings.StartMap),
                InProgress = true
            };
        }
        public CommandContext Perform(IUserAction action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }

            var context = new CommandContext {
                Command = action.Name
            };

            try
            {
                action.Perform(context);
            }
            catch (Exception error)
            {
                context.AddError(error.ToString());
            }
            return(context);
        }