mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-31 02:06:08 +00:00
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:
16
gym/wrappers/order_enforcing.py
Normal file
16
gym/wrappers/order_enforcing.py
Normal 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)
|
Reference in New Issue
Block a user