File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ New Features:
23
23
24
24
Bug Fixes:
25
25
^^^^^^^^^^
26
+ - Fixed Atari wrapper that missed the reset condition (@luizapozzobon)
26
27
27
28
Deprecations:
28
29
^^^^^^^^^^^^^
@@ -1218,4 +1219,4 @@ And all the contributors:
1218
1219
@Gregwar @ycheng517 @quantitative-technologies @bcollazo @git-thor @TibiGG @cool-RR @MWeltevrede
1219
1220
@Melanol @qgallouedec @francescoluciano @jlp-ue @burakdmb @timothe-chaumont @honglu2875 @yuanmingqi
1220
1221
@anand-bala @hughperkins @sidney-tio @AlexPasqua @dominicgkerr @Akhilez @Rocamonde @tobirohrer @ZikangXiong
1221
- @DavyMorgan
1222
+ @DavyMorgan @luizapozzobon
Original file line number Diff line number Diff line change @@ -106,7 +106,13 @@ def reset(self, **kwargs) -> np.ndarray:
106
106
obs = self .env .reset (** kwargs )
107
107
else :
108
108
# no-op step to advance from terminal/lost life state
109
- obs , _ , _ , _ = self .env .step (0 )
109
+ obs , _ , done , _ = self .env .step (0 )
110
+
111
+ # The no-op step can lead to a game over, so we need to check it again
112
+ # to see if we should reset the environment and avoid the
113
+ # monitor.py `RuntimeError: Tried to step environment that needs reset`
114
+ if done :
115
+ obs = self .env .reset (** kwargs )
110
116
self .lives = self .env .unwrapped .ale .lives ()
111
117
return obs
112
118
@@ -150,9 +156,6 @@ def step(self, action: int) -> GymStepReturn:
150
156
151
157
return max_frame , total_reward , done , info
152
158
153
- def reset (self , ** kwargs ) -> GymObs :
154
- return self .env .reset (** kwargs )
155
-
156
159
157
160
class ClipRewardEnv (gym .RewardWrapper ):
158
161
"""
You can’t perform that action at this time.
0 commit comments