Skip to content

Commit

Permalink
Cap new rating before computing new volatility
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjaclasher authored and quantum5 committed Jul 4, 2021
1 parent ba7b768 commit 38f3f8b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions judge/ratings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ def recalculate_ratings(old_rating, old_volatility, actual_rank, times_rated, is

new_rating[i] = (old_rating[i] + Weight * PerfAs) / (1.0 + Weight)

if abs(old_rating[i] - new_rating[i]) > Cap:
if old_rating[i] < new_rating[i]:
new_rating[i] = old_rating[i] + Cap
else:
new_rating[i] = old_rating[i] - Cap

if times_rated[i] == 0:
new_volatility[i] = 385
else:
Expand All @@ -101,12 +107,6 @@ def recalculate_ratings(old_rating, old_volatility, actual_rank, times_rated, is
# later on, prohibit this by ensuring their volatility never increases in this situation
new_volatility[i] = min(new_volatility[i], old_volatility[i])

if abs(old_rating[i] - new_rating[i]) > Cap:
if old_rating[i] < new_rating[i]:
new_rating[i] = old_rating[i] + Cap
else:
new_rating[i] = old_rating[i] - Cap

# try to keep the sum of ratings constant
adjust = float(sum(old_rating) - sum(new_rating)) / N
new_rating = list(map(adjust.__add__, new_rating))
Expand Down

0 comments on commit 38f3f8b

Please sign in to comment.