Wrapping the Gym environment

Finally, we will apply the preceding wrappers that we developed based on the environment configuration we specify using the parameters.JSON file:

def make_env(env_id, env_conf):    env = gym.make(env_id)    if 'NoFrameskip' in env_id:        assert 'NoFrameskip' in env.spec.id        env = NoopResetEnv(env, noop_max=30)        env = MaxAndSkipEnv(env, skip=env_conf['skip_rate'])    if env_conf['episodic_life']:        env = EpisodicLifeEnv(env)    if 'FIRE' in env.unwrapped.get_action_meanings():        env = FireResetEnv(env)    env = AtariRescale(env, env_conf['useful_region'])    env = NormalizedEnv(env)    if env_conf['clip_reward']:        env = ClipRewardEnv(env)    return env

All of the environment wrappers that we discussed previously are implemented and available in ...

Get Hands-On Intelligent Agents with OpenAI Gym now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.