Skip to content
DeepForgeby svx
All problems

Elo Round Robin Ratings

Problem

Update Elo ratings through a list of results.

Each result is [i, j, score_i] with score_i in {0, 0.5, 1}; expected_i = 1 / (1 + 10 ** ((rating_j - rating_i) / 400)) and both ratings move by k * (score_i - expected_i) in opposite directions using the current ratings. Return the updated rating list in the original order.

Hint

Processing matches sequentially lets later games see the ratings updated by earlier ones.

Test cases

case 1
in: [[1500,1500],32,[[0,1,1]]]
expected: [1516,1484]
case 2
in: [[1500,1500],32,[[0,1,0.5]]]
expected: [1500,1500]
case 3
in: [[1600,1400],16,[[1,0,1]]]
expected: [1587.8440491736326,1412.1559508263674]
case 4
in: [[1500,1500],32,[[0,1,1],[1,0,1]]]
expected: [1498.5304984710244,1501.4695015289756]
Starter codePython
def elo_round_robin(ratings, k, results):
    # Your code here
    pass

4 test cases · run your code against them in the editor