Skip to content

Commit

Permalink
fixed reward
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocspc committed May 11, 2020
1 parent 70dbae8 commit b78a093
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions urnai/agents/rewards/vizdoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def __init__(self, method):
def get_reward(self, obs, reward, done):
r = 0

if method == VizDoomHealthGatheringReward.METHOD_CUMULATIVE:
if self.method == VizDoomHealthGatheringReward.METHOD_CUMULATIVE:
r += obs.game_variables[VizDoomHealthGatheringReward.HEALTH]
elif method == VizDoomHealthGatheringReward.METHOD_DIFFERENCE:
elif self.method == VizDoomHealthGatheringReward.METHOD_DIFFERENCE:
r += obs.game_variables[VizDoomHealthGatheringReward.HEALTH] - self.prev_health
self.prev_health = obs.game_variables[VizDoomHealthGatheringReward.HEALTH]
elif method == VizDoomHealthGatheringReward.METHOD_POSITIVE_ONLY:
elif self.method == VizDoomHealthGatheringReward.METHOD_POSITIVE_ONLY:
r += obs.game_variables[VizDoomHealthGatheringReward.HEALTH] - self.prev_health
self.prev_health = obs.game_variables[VizDoomHealthGatheringReward.HEALTH]

Expand Down

0 comments on commit b78a093

Please sign in to comment.