Skip to content

Instantly share code, notes, and snippets.

@davidADSP
Created January 23, 2021 22:06
Show Gist options
  • Save davidADSP/46fde68c0f433739e7712b83e03efc17 to your computer and use it in GitHub Desktop.
Save davidADSP/46fde68c0f433739e7712b83e03efc17 to your computer and use it in GitHub Desktop.
The step method of the SelfPlayEnv calss
class SelfPlayEnv(env):
# ...
def step(self, action):
self.render()
observation, reward, done, _ = super(SelfPlayEnv, self).step(action)
logger.debug(f'Action played by agent: {action}')
logger.debug(f'Rewards: {reward}')
logger.debug(f'Done: {done}')
if not done:
observation, reward, done, _ = self.continue_game()
agent_reward = reward[self.agent_player_num]
logger.debug(f'\nReward To Agent: {agent_reward}')
if done:
self.render()
return observation, agent_reward, done, {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment