register.py 429 B

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