MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / step

Method step

examples/DeepQNetwork/atari.py:148–165  ·  view source on GitHub ↗
(self, act)

Source from the content-addressed store, hash-verified

146 pass # visualization for this env is through the viz= argument when creating the player
147
148 def step(self, act):
149 oldlives = self.ale.lives()
150 r = 0
151 for k in range(self.frame_skip):
152 if k == self.frame_skip - 1:
153 self.last_raw_screen = self._grab_raw_image()
154 r += self.ale.act(self.actions[act])
155 newlives = self.ale.lives()
156 if self.ale.game_over() or \
157 (self.live_lost_as_eoe and newlives < oldlives):
158 break
159
160 isOver = self.ale.game_over()
161 if self.live_lost_as_eoe:
162 isOver = isOver or newlives < oldlives
163
164 info = {'ale.lives': newlives}
165 return self._current_state(), r, isOver, info
166
167
168if __name__ == '__main__':

Callers 2

atari.pyFile · 0.45
play_one_episodeFunction · 0.45

Calls 2

_grab_raw_imageMethod · 0.95
_current_stateMethod · 0.95

Tested by

no test coverage detected