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

Fixing seeding in MiniGrid #34

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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