Skip to content

Instantly share code, notes, and snippets.

@fabito
Created August 22, 2018 02:03
Show Gist options
  • Save fabito/40a5a512b1f7b44b170dbf904068d8c9 to your computer and use it in GitHub Desktop.
Save fabito/40a5a512b1f7b44b170dbf904068d8c9 to your computer and use it in GitHub Desktop.
neyboy_env - step method
def step(self, action):
self.game.resume()
if action == ACTION_LEFT:
self.game.tap_left()
elif action == ACTION_RIGHT:
self.game.tap_right()
self.state = self.game.get_state()
self.game.pause()
is_over = self.state.status == GAME_OVER_SCREEN
if is_over:
reward = -1
else:
reward = self.state.score
return self.state.snapshot, reward, is_over, dict()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment