Skip to content
This repository has been archived by the owner on Feb 13, 2025. It is now read-only.

Commit

Permalink
Merge pull request #34 from facebookresearch/samvelyan/minigrid
Browse files Browse the repository at this point in the history
Fixing seeding in MiniGrid
  • Loading branch information
samvelyan authored Nov 22, 2021
2 parents a971025 + a632b7d commit 5b1d9f9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions minihack/envs/minigrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,29 @@ def get_env_desc(self):

return lev_gen.get_des()

def seed(self, core=None, disp=None, reseed=False):
"""The signature of this method corresponds to that of NLE base class.
For more information see
https://github.com/facebookresearch/nle/blob/main/nle/env/base.py.
Sets the state of the NetHack RNGs after the next reset.
Arguments:
core [int or None]: Seed for the core RNG. If None, chose a random
value.
disp [int or None]: Seed for the disp (anti-TAS) RNG. If None, chose
a random value.
reseed [boolean]: As an Anti-TAS (automation) measure,
NetHack 3.6 reseeds with true randomness every now and then. This
flag enables or disables this behavior. If set to True,
trajectories won't be reproducible.
Returns:
[tuple] The seeds supplied, in the form (core, disp, reseed).
"""
self.minigrid_env.seed(core)
return super().seed(core, disp, reseed)

def reset(self, wizkit_items=None):
des_file = self.get_env_desc()
self.update(des_file)
Expand Down

0 comments on commit 5b1d9f9

Please sign in to comment.