def create_atari_environment(name):
  """
  Create OpenAI Gym atari environment
  :param name: name of  the atari game
  :return: Preconfigured environment suitable for atari games
  """
  env = gym.make(name)
  env = NoopResetEnv(env, noop_max=30)
  env = EpisodicLifeEnv(env)
  env = ClipRewardEnv(env)

  action_names = env.unwrapped.get_action_meanings()
  if 'FIRE' in action_names:
    env = FireResetEnv(env)

  env = WarpFrame(env)
  env = FrameStack(env, k=4)
  return env
Create OpenAI Gym atari environment
  :param name: name of  the atari game
  :return: Preconfigured environment suitable for atari games