Reset only when lives are exhausted. This way all states are still reachable even though lives are episodic, and the learner need not know about any of this behind-the-scenes.
(self, **kwargs)
| 112 | return obs, reward, done, info |
| 113 | |
| 114 | def reset(self, **kwargs): |
| 115 | """Reset only when lives are exhausted. |
| 116 | This way all states are still reachable even though lives are episodic, |
| 117 | and the learner need not know about any of this behind-the-scenes. |
| 118 | """ |
| 119 | if self.was_real_done: |
| 120 | obs = self.env.reset(**kwargs) |
| 121 | else: |
| 122 | # no-op step to advance from terminal/lost life state |
| 123 | obs, _, _, _ = self.env.step(0) |
| 124 | self.lives = self.env.unwrapped.ale.lives() |
| 125 | return obs |
| 126 | |
| 127 | |
| 128 | class MaxAndSkipEnv(gym.Wrapper): |