register.py 435 B

12345678910111213141516171819202122
  1. from gym.envs.registration import register as gym_register
  2. env_list = []
  3. def register(
  4. id,
  5. entry_point,
  6. reward_threshold=0.95
  7. ):
  8. assert id.startswith("MiniGrid-")
  9. assert id not in env_list
  10. # Register the environment with OpenAI gym
  11. gym_register(
  12. id=id,
  13. entry_point=entry_point,
  14. reward_threshold=reward_threshold
  15. )
  16. # Add the environment to the set
  17. env_list.append(id)