mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-19 05:25:54 +00:00
Switch to a global PRNG for action/observation spaces (#144)
cf 58e6aa95e5 (commitcomment-17669277)
This commit is contained in:
@@ -54,15 +54,14 @@ class DoomBasicEnv(doom_env.DoomEnv):
|
||||
self.viewer = None
|
||||
self.game.init()
|
||||
self.game.new_episode()
|
||||
|
||||
# 3 allowed actions [0, 9, 10] (must match .cfg file)
|
||||
self.action_space = spaces.HighLow(np.matrix([[0, 1, 0]] * 3))
|
||||
self.observation_space = spaces.Box(low=0, high=255, shape=(self.screen_height, self.screen_width, 3))
|
||||
|
||||
self._seed()
|
||||
|
||||
def _seed(self, seed=None):
|
||||
np_random, seed1 = seeding.np_random(seed)
|
||||
# Derive a random seed.
|
||||
seed2 = seeding.hash_seed(seed1 + 1) % 2**32
|
||||
self.game.set_seed(seed2)
|
||||
|
||||
# 3 allowed actions [0, 9, 10] (must match .cfg file)
|
||||
self.action_space = spaces.HighLow(np.matrix([[0, 1, 0]] * 3), np_random=np_random)
|
||||
self.observation_space = spaces.Box(low=0, high=255, shape=(self.screen_height, self.screen_width, 3), np_random=np_random)
|
||||
return [seed1, seed2]
|
||||
seed = seeding.hash_seed(seed) % 2**32
|
||||
self.game.set_seed(seed)
|
||||
return [seed]
|
||||
|
Reference in New Issue
Block a user