Skip to content

Commit

Permalink
refactored get_possible_affects
Browse files Browse the repository at this point in the history
get_possible_affects no longer uses a pointless continue and should be more readable now
  • Loading branch information
njunius committed May 6, 2022
1 parent 2e5ceaa commit f849b1f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/core/affecter.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,14 @@ def get_possible_affects(self, affect_vector, allowable_error = 0.00000001):

if not prevailing_affects:
prevailing_affects.append(current_affect)
continue

highest_value_seen = affect_vector[prevailing_affects[0]]

if highest_value_seen < current_affect_value:
prevailing_affects = []
prevailing_affects.append(current_affect)
elif abs(highest_value_seen - current_affect_value) < allowable_error:
prevailing_affects.append(current_affect)
else:
highest_value_seen = affect_vector[prevailing_affects[0]]

if highest_value_seen < current_affect_value:
prevailing_affects = []
prevailing_affects.append(current_affect)
elif abs(highest_value_seen - current_affect_value) < allowable_error:
prevailing_affects.append(current_affect)

return prevailing_affects

Expand Down

0 comments on commit f849b1f

Please sign in to comment.