Created
January 23, 2021 22:06
-
-
Save davidADSP/46fde68c0f433739e7712b83e03efc17 to your computer and use it in GitHub Desktop.
The step method of the SelfPlayEnv calss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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