Elo Rating Algorithm is widely used rating algorithm that is used to rank players in many competitive games.
Players with higher ELO rating have a higher probability of winning a game than a player with lower ELO rating. After each game, ELO rating of players is updated. If a player with higher ELO rating wins, only a few points are transferred from the lower rated player. However if lower rated player wins, then transferred points from a higher rated player are far greater.
P1: Probability of winning of player with rating2
P2: Probability of winning of player with rating1.
P1 = (1.0 / (1.0 + pow(10, ((rating1 – rating2) / 400))));
P2 = (1.0 / (1.0 + pow(10, ((rating2 – rating1) / 400))));
Obviously, P1 + P2 = 1.
The rating of player is updated using the formula given below :-
rating1 = rating1 + K*(Actual Score – Expected score);
In most of the games, “Actual Score” is either 0 or 1 means player either wins or loose. K is a constant. If K is of a lower value, then the rating is changed by a small fraction but if K is of a higher value, then the changes in the rating are significant. Different organizations set a different value of K.
Suppose there is a live match on chess.com between two players
rating1 = 1200, rating2 = 1000;
P1 = (1.0 / (1.0 + pow(10, ((1000-1200) / 400)))) = 0.76
P2 = (1.0 / (1.0 + pow(10, ((1200-1000) / 400)))) = 0.24
And Assume constant K=30;
CASE-1 : Suppose Player 1 wins:
rating1 = rating1 + k*(actual – expected) = 1200+30(1 – 0.76) = 1207.2;
rating2 = rating2 + k*(actual – expected) = 1000+30(0 – 0.24) = 992.8;
Case-2 : Suppose Player 2 wins:
rating1 = rating1 + k*(actual – expected) = 1200+30(0 – 0.76) = 1177.2;
rating2 = rating2 + k*(actual – expected) = 1000+30(1 – 0.24) = 1022.8;
Updated Ratings:- Ra = 1207.207642 Rb = 992.792419
Time complexity of algorithm depends mostly on the complexity of pow function whose
complexity is dependent on Computer Architecture.
On x86, this is constant time operation:-O(1)
- When to use each Sorting Algorithm
- Raft Consensus Algorithm
- Slow Start Backoff Algorithm for Ad-Hoc
- Sorting algorithm visualization : Insertion Sort
- Sorting Algorithm Visualization : Quick Sort
- New Algorithm to Generate Prime Numbers from 1 to Nth Number
- Simplified International Data Encryption Algorithm (IDEA)
- Queries for count of even digit sum elements in given range using MO's Algorithm
- Complete Interview Preparation With Doubt Assistance - INR 90 Lakh Cashback Pool Offer!!
- GeeksforGeeks Skill-Dependence Days 2020 - A Battle Against Unemployment
- Swap the first and last character of a string in Java
- What happens when we call a Function
- Remove the first and last occurrence of a given Character from a String
- Tips for testing code in Compeititive programming
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.