Skip to content

Commit

Permalink
change Improving.Config weighting formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ImogenBits committed Dec 29, 2023
1 parent 96590b7 commit 1c35b43
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions algobattle/battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ class Config(Battle.Config):
"""Instance size that will be fought at."""
num_fights: int = 20
"""Number of fights that will be fought."""
weighting: Annotated[int, Ge(1)] = 10
weighting: Annotated[float, Ge(0)] = 1.1
"""How much each successive fight should be weighted more than the previous."""
scores: set[Role] = {Role.generator, Role.solver}
"""Who to show each fight's scores to."""
Expand Down Expand Up @@ -755,9 +755,8 @@ def score(self, config: Config) -> float:
if len(self.fights) == 0:
return 0
else:
weight = 1 + config.weighting / 100
total = sum(f.score * weight**i for (i, f) in enumerate(self.fights))
quotient = (1 - weight ** len(self.fights)) / (1 - weight)
total = sum(f.score * config.weighting**i for (i, f) in enumerate(self.fights))
quotient = (1 - config.weighting ** len(self.fights)) / (1 - config.weighting)
return total / quotient

@staticmethod
Expand Down

0 comments on commit 1c35b43

Please sign in to comment.