The Basics of Elo
The Elo rating system is a method for calculating the relative skill levels of players in competitor-versus-competitor games such as chess. It is named after its creator Arpad Elo, a Hungarian-American physics professor.
In this system, winning or losing a match causes your Elo rating to change. The amount your rating changes depends on:
- The outcome of the match (win, loss, or sometimes draw).
- The difference in Elo ratings between you and your opponent. Beating a much higher-rated opponent gives you more points than beating a lower-rated one. Conversely, losing to a much lower-rated opponent costs you more points.
Our system uses a K-factor of 32. The K-factor determines how much an Elo rating changes after a match. A higher K-factor means ratings change more dramatically, while a lower K-factor makes changes smaller.
Calculating Expected Score
Before updating Elos, we first calculate the 'expected score' for each player (or team). The expected score represents the probability of a player winning against another based on their current Elo ratings.
The formula for Player A's expected score against Player B is:
E_A = 1 / (1 + 10^((R_B - R_A) / 400))
Where:
E_Ais Player A's expected score (a value between 0 and 1).R_Ais Player A's current Elo rating.R_Bis Player B's current Elo rating.
Player B's expected score (E_B) would then be 1 - E_A.
Updating Elo Ratings (General Formula)
After a match, a player's new Elo rating is calculated using their old rating, their actual score (1 for a win, 0.5 for a draw, 0 for a loss), and their expected score:
R'_A = R_A + K * (S_A - E_A)
Where:
R'_Ais Player A's new Elo rating.R_Ais Player A's old Elo rating.Kis the K-factor (32 in our system).S_Ais Player A's actual score from the match.E_Ais Player A's expected score, calculated as described above.
1v1 Matches
For 1v1 matches, the calculation is straightforward using the general formula above for each player.
Example: If Player A (1500 Elo) plays Player B (1500 Elo) and Player A wins:
- Expected score for Player A (
E_A) = 1 / (1 + 10^((1500 - 1500) / 400)) = 1 / (1 + 10^0) = 1 / (1 + 1) = 0.5. - Player A's actual score (
S_A) = 1 (for the win). - Player A's new Elo = 1500 + 32 * (1 - 0.5) = 1500 + 32 * 0.5 = 1500 + 16 = 1516.
- Player B's actual score (
S_B) = 0 (for the loss). - Player B's expected score (
E_B) = 1 -E_A= 0.5. - Player B's new Elo = 1500 + 32 * (0 - 0.5) = 1500 - 16 = 1484.
2v2 Matches
For 2v2 matches, the calculation involves a few more steps:
- Calculate Average Team Elo: The Elo rating for a team is the average of its two players' Elo ratings.
AvgElo_Team1 = (Player1_Elo + Player2_Elo) / 2 - Calculate Expected Score for Teams: The expected score is calculated using the average team Elos, similar to the 1v1 calculation.
E_Team1 = 1 / (1 + 10^((AvgElo_Team2 - AvgElo_Team1) / 400)) - Determine Actual Team Score: The actual score for a team is 1 if they win the match (score more goals), 0 if they lose, and 0.5 if they draw (equal goals).
- Calculate Elo Change for the Team: The total Elo points gained or lost by the team is calculated using the K-factor, the team's actual score, and the team's expected score.
Team_Elo_Change = K * (S_Team1 - E_Team1) - Score-Specific Boosts: To reward decisive victories, additional Elo points are awarded (or deducted from the losing team) for specific scores:
- If a team wins 6-0, they get an additional 6 Elo points (
ELO_BOOST_6_0). The losing team loses an additional 6 points. - If a team wins 6-2, they get an additional 3 Elo points (
ELO_BOOST_6_2). The losing team loses an additional 3 points.
Team_Elo_Changecalculated in the previous step.
Note: The test files for the Elo calculations (`elokickers/tests/EloTest.php`) contain comments that mention older boost values (10 for 6-0 and 5 for 6-2). However, the actual code and current system use 6 and 3 points, respectively, as defined in `elokickers/public_html/php/config.php`. - If a team wins 6-0, they get an additional 6 Elo points (
- Distribute Elo Change to Players: The final calculated
Team_Elo_Change(including any boosts) is then added to each player on the winning team and subtracted from each player on the losing team. Both players on a team gain or lose the same number of Elo points.
Example: Team A (Player A1: 1600 Elo, Player A2: 1400 Elo) plays Team B (Player B1: 1500 Elo, Player B2: 1500 Elo). Team A wins 6-0.
- AvgElo_TeamA = (1600 + 1400) / 2 = 1500.
- AvgElo_TeamB = (1500 + 1500) / 2 = 1500.
- Expected score for Team A (
E_TeamA) = 0.5 (since average Elos are equal). - Actual score for Team A (
S_TeamA) = 1. - Base Elo change for Team A = 32 * (1 - 0.5) = +16 points.
- Boost for 6-0 win = +6 points.
- Total Elo change for Team A = 16 + 6 = +22 points.
- New Elo for Player A1 = 1600 + 22 = 1622.
- New Elo for Player A2 = 1400 + 22 = 1422.
- New Elo for Player B1 = 1500 - 22 = 1478.
- New Elo for Player B2 = 1500 - 22 = 1478.