Skip to content

Commit

Permalink
Update new_rating before computing new_volatility (DMOJ#840)
Browse files Browse the repository at this point in the history
Closes DMOJ#811.
  • Loading branch information
xiaowuc1 authored and Ninjaclasher committed Mar 3, 2019
1 parent 924db2c commit 2aaf434
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion judge/ratings.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ def recalculate_ratings(old_rating, old_volatility, actual_rank, times_rated):

Cap = 150.0 + 1500.0 / (times_rated[i] + 2)

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

if times_rated[i] == 0:
new_volatility[i] = 385
else:
new_volatility[i] = math.sqrt(((new_rating[i] - old_rating[i]) ** 2) / Weight + (old_volatility[i] ** 2) / (Weight + 1))
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
Expand Down

0 comments on commit 2aaf434

Please # to comment.