Skip to content

Commit

Permalink
Fixed the reward hacking bug
Browse files Browse the repository at this point in the history
See oxwhirl#72 for more details.
  • Loading branch information
samvelyan authored Apr 19, 2022
1 parent 2ff475a commit 8ab0b54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion smac/env/starcraft2/starcraft2.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ def reward_battle(self):
delta_enemy += prev_health - e_unit.health - e_unit.shield

if self.reward_only_positive:
reward = abs(delta_enemy + delta_deaths) # shield regeneration
reward = max(delta_enemy + delta_deaths, 0) # shield regeneration
else:
reward = delta_enemy + delta_deaths - delta_ally

Expand Down

0 comments on commit 8ab0b54

Please sign in to comment.