Elokickers

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:

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:

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:

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:

2v2 Matches

For 2v2 matches, the calculation involves a few more steps:

  1. 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
  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))
  3. 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).
  4. 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)
  5. 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.
    These boosts are added to (or subtracted from) the Team_Elo_Change calculated 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`.
  6. 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.