removed calls to reset from init (#2394)

* removed all calls to reset

* passing tests

* fix off-by-one error

* revert

* merge master into branch

* add OrderEnforcing Wrapper

* add orderenforcing to the docs

* add option for disabling

* add argument to EnvSpec
This commit is contained in:
Ahmed Omar
2021-09-16 16:16:49 +02:00
committed by GitHub
parent e212043a93
commit 2754d9737e
9 changed files with 47 additions and 13 deletions

View File

@@ -0,0 +1,16 @@
import gym
class OrderEnforcing(gym.Wrapper):
def __init__(self, env):
super(OrderEnforcing, self).__init__(env)
self._has_reset = False
def step(self, action):
assert self._has_reset, "Cannot call env.step() before calling reset()"
observation, reward, done, info = self.env.step(action)
return observation, reward, done, info
def reset(self, **kwargs):
self._has_reset = True
return self.env.reset(**kwargs)