Skip to content

Instantly share code, notes, and snippets.

@AurelianTactics
Created August 4, 2018 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AurelianTactics/d753699240e21d239ac0cdef2bf2521d to your computer and use it in GitHub Desktop.
Save AurelianTactics/d753699240e21d239ac0cdef2bf2521d to your computer and use it in GitHub Desktop.
class MultiEnv(gym.Env):
def __init__(self, env_config):
# pick actual env based on worker and env indexes
#print("worker index is {}".format(env_config.worker_index))
#print("testing vector_index {}".format(env_config.vector_index))
#BustAMove.Challengeplay0
challenge_level = env_config.worker_index % 5
self.env = sonic_on_ray.make(game='BustAMove-Snes', state='BustAMove.Challengeplay{}'.format(challenge_level)) #BustAMove.1pplay.Level10
self.action_space = self.env.action_space
self.observation_space = self.env.observation_space
def reset(self):
return self.env.reset()
def step(self, action):
return self.env.step(action)
register_env("multienv", lambda c: MultiEnv(c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment