public void ExecuteCommands(string commands) { foreach (var command in commands) { _availableCommands[command].Execute(this, _planet); if (_planet.IsObstacle(PositionX, PositionY)) { _availableCommands[command].Rollback(this, _planet); throw new ObstacleFoundException("Obstacle found"); } } }