7

I am starting a chess club at my school, and I want to create a Python program to calculate and store Elo ratings for each player. I am confident I can program it, but I just need to know:

How do you calculate Elo?

What i am looking for:

  • Equations to calculate expected outcome for each player.
  • Equations to calculate elo change using this.
  • How to deal with a draw.
  • How the value of K can be calculated, or suggestions for a static value of K which would work for students.

So far the best explanation I have found is the League of Legends rating system explained in this video (which happens to be the same system used in chess).

1
  • You could use something like Bayeselo instead. It probably won't be like the FIDE system because it has no anchors to the FIDE rating; so using Bayeselo would just make your life easier.
    – ZirconiumX
    Commented Aug 11, 2016 at 8:58

3 Answers 3

10
+50

Here you have some more information about Elo system that maybe it's useful for you.

Arpad Elo designed his system assuming a normal distribution in the results achieved by the players with a standard deviation of 200 rating points. So he used a logistic function to calculate the expected results by a player. The actual function (actually a table is used with minimal differences with this function) is:

WEa = 1 / (1 + 10^((Rb-Ra)/400)), rounded to two decimal digits

WEa is the expected result for player a, while Rb and Ra are the ratings of both players. As you can see in a game between two players having 400 points of difference in rating the chances of winning the game are 10:1.

After the game(s) expected and actual results of a player are compared, so players performing better than their expected results increase their ratings, and players performing worse decrease them. To do that the difference between expected and actual results is multiplied by a constant factor K. This constant value has to be small enough to make the system stable and avoid reflecting the very last results only, but large enough to be able to track players evolution. I guess a good value would be between 20 and 30, Jeff Sonas for example suggest 24 as the optimum value, while FIDE handbook points that rating stabilizes after 70 games (K10), 35 games (K20) and 18 games (K40), maybe these numbers can be useful for you to set your own K value.

Using a greater K value the very first few games can help your students to reach an approximate rating quickly and then you can change to a smaller K value.

3
  • so how do you calculate elo change after calculating the expected outcome for each player? what happens in the case of a stalemate?
    – Aric
    Commented Aug 15, 2016 at 15:15
  • 1
    Let's see, for example, that two players with a rating difference of 165 points play together. Expected results are .72 (A) and .28 (B). Assume K20. Results: -- player A wins, the player gains (1-.72)*20=5.6 points, and his opponent loses (0-.28)*20=-5.6 points -- player B wins, and gains (1-.28)*20=14.4 points, player B loses (0-.72)*20 = -14.4 points -- a draw, the player A (.5-.72)*20 = -4.4 points, player B gains +4.4 points. So just it's a substraction (actual result minus expected result) and a multiplication. Stalemate is a draw, and I would not advice you to change this.
    – sharcashmo
    Commented Aug 15, 2016 at 15:49
  • That's the part i was missing.
    – Aric
    Commented Aug 15, 2016 at 17:13
2

All the informations regarding FIDE elo rating can be found here :

https://www.fide.com/fide/handbook.html?id=172&view=article

Each player must start with an estimated FIDE elo rating. Usually people are playing tournaments against FIDE players and then get a rating. (see article 8.2)

The FIDE elo system update your rating after each game played according to article 8.5.

7
  • If possible i need a system where every player starts at a given Elo (say, 2000). In this case, would i just use article 8.5 to calculate the Elo change after each game?
    – Aric
    Commented Aug 11, 2016 at 9:40
  • Yes, it should be working.
    – Tanj
    Commented Aug 11, 2016 at 9:45
  • I will try this, however i am still open for new suggestions
    – Aric
    Commented Aug 11, 2016 at 9:59
  • @AricFowler Just to have it mentioned: 2000 is a very high starting Elo rating under normal circumstances, so if you want the students' ratings to correspond somewhat to what their actual Elo rating would be, it would be wise to start somewhere lower, say 1300-1400.
    – Scounged
    Commented Aug 11, 2016 at 11:23
  • This is an internal rating system, it is not intended to compare with other systems in any way.
    – Aric
    Commented Aug 11, 2016 at 11:26
-1

Per https://en.wikipedia.org/wiki/Chess_rating_system

A player's new rating after a tournament is calculated :

Rn = Ro + (K/2)(W - L + (Sum of rating differences/2C))

Rn is the new rating, Ro is the old rating. W and L are the number of wins and losses. A rating difference is the opponent's rating minus the player's rating, not the other way around.

C will determine how spaced out the ratings are, i.e. the standard deviation. It appears that 200 is commonly used.

K will determine how much of an effect each game has. FIDE uses 30, and 20 once a player reaches IM. http://www.fide.com/component/content/article/1-fide-news/3963-rating-regulations-the-k-factor

A draw is 0 wins and 0 losses.

1
  • This is not correct. See my reply to check the actual formulas, the formula you use is a linear aproximation but you can compare it with the table used. Draws of course give wins and losses, you can check any tournament results at chess-results (ex. chess-results.com/…). And, finally, FIDE uses K20, with the exceptions: - Once the player hits 2400 rating, use K10 - Players under 18 use K40 - Players use K40 for their 30 first games. BTW, ratings regulations changed at 2014, maybe this is the reason you're data is wrong.
    – sharcashmo
    Commented Aug 17, 2016 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.