Answers.Body: <p>All the informations regarding FIDE elo rating can be found here :</p>
  
  <p><a href="https://www.fide.com/fide/handbook.html?id=172&amp;view=article" rel="nofollow">https://www.fide.com/fide/handbook.html?id=172&amp;view=article</a></p>
  
  <p>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) </p>
  
  <p>The FIDE elo system update your rating after each game played according to article 8.5.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-11T09:40:41.643Z
Answers.Text: 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?
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-11T09:45:05.117Z
Answers.Text: Yes, it should be working.
Answers.UserDisplayName: Tanj
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-11T09:59:00.343Z
Answers.Text: I will try this, however i am still open for new suggestions
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-11T11:23:48.313Z
Answers.Text: @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.
Answers.UserDisplayName: Scounged
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-11T11:26:58.647Z
Answers.Text: This is an internal rating system, it is not intended to compare with other systems in any way.
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-15T06:29:31.470Z
Answers.Text: If you're just looking for an internal rating system to compare players in your closed player population, implementing your own version of the FIDE system should work well.  But if you want an idea of why the formulas are the way they are, you should read Elo's book.  It's actually pretty interesting.  https://www.amazon.com/Rating-Chess-Players-Past-Present/dp/0923891277
Answers.UserDisplayName: patbarron
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-16T10:01:04.660Z
Answers.Text: @patbarron looks interesting
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-11T09:00:58.153Z
Answers.LastActivityDate: 2016-08-11T09:00:58.153Z
Answers.UserDisplayName: Tanj
Answers.Body: <p>Per <a href="https://en.wikipedia.org/wiki/Chess_rating_system" rel="nofollow">https://en.wikipedia.org/wiki/Chess_rating_system</a></p>
  
  <p>A player's new rating after a tournament is calculated :</p>
  
  <pre><code>Rn = Ro + (K/2)(W - L + (Sum of rating differences/2C))
  </code></pre>
  
  <p>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. </p>
  
  <p>C will determine how spaced out the ratings are, i.e. the standard deviation. It appears that 200 is commonly used.</p>
  
  <p>K will determine how much of an effect each game has. FIDE uses 30, and 20 once a player reaches IM. <a href="http://www.fide.com/component/content/article/1-fide-news/3963-rating-regulations-the-k-factor" rel="nofollow">http://www.fide.com/component/content/article/1-fide-news/3963-rating-regulations-the-k-factor</a></p>
  
  <p>A draw is 0 wins and 0 losses. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T20:32:16.420Z
Answers.Text: 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. http://chess-results.com/tnr209009.aspx?lan=9&art=9&fed=ESP&turdet=YES&wi=821&snr=3). 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.
Answers.UserDisplayName: sharcashmo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-17T14:57:23.967Z
Answers.LastActivityDate: 2016-08-17T14:57:23.967Z
Answers.UserDisplayName: Alpha Draconis
Answers.Body: <p>Here you have some more information about Elo system that maybe it's useful for you.</p>
  
  <p>Arpad Elo designed his system assuming a <a href="https://en.wikipedia.org/wiki/Normal_distribution" rel="nofollow noreferrer">normal distribution</a> in the results achieved by the players with a standard deviation of 200 rating points. So he used a <a href="https://en.wikipedia.org/wiki/Logistic_function" rel="nofollow noreferrer">logistic function</a> to calculate the expected results by a player. The actual function (actually a table is used with minimal differences with this function) is:</p>
  
  <pre><code>WEa = 1 / (1 + 10^((Rb-Ra)/400)), rounded to two decimal digits
  </code></pre>
  
  <p>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.</p>
  
  <p>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, <a href="http://en.chessbase.com/post/the-sonas-rating-formula-better-than-elo-" rel="nofollow noreferrer">Jeff Sonas for example suggest 24 as the optimum value</a>, while <a href="https://www.fide.com/fide/handbook.html?id=172&amp;view=article" rel="nofollow noreferrer">FIDE handbook</a> 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.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-15T15:15:32.700Z
Answers.Text: so how do you calculate elo change after calculating the expected outcome for each player? what happens in the case of a stalemate?
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-15T15:49:29.327Z
Answers.Text: 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.
Answers.UserDisplayName: sharcashmo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-15T17:13:06.243Z
Answers.Text: That's the part i was missing.
Answers.UserDisplayName: Aric
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2016-08-15T15:09:54.047Z
Answers.LastActivityDate: 2020-03-22T17:33:14.937Z
Answers.LastEditDate: 2020-03-22T17:33:14.937Z
Answers.UserDisplayName: sharcashmo
Body: <p>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:</p>
  
  <p><strong>How do you calculate Elo?</strong></p>
  
  <p>What i am looking for:</p>
  
  <ul>
  <li>Equations to calculate expected outcome for each player.</li>
  <li>Equations to calculate elo change using this.</li>
  <li>How to deal with a draw.</li>
  <li>How the value of K can be calculated, or suggestions for a static value of K which would work for students.</li>
  </ul>
  
  <p>So far the best explanation I have found is the League of Legends rating system explained in <a href="https://www.youtube.com/watch?v=1_xLjI6zN3I" rel="noreferrer">this</a> video (which happens to be the same system used in chess).</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-11T08:58:38.343Z
Comments.Text: 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.
Comments.UserDisplayName: ZirconiumX
Tags: <rating><elo>
Title: How do you calculate elo?
ThreadText: # How do you calculate elo?
  
  (Asked by: username_0 on 2016-08-11)
  
  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](https://www.youtube.com/watch?v=1_xLjI6zN3I) video (which happens to be the same system used in chess).
  
  **Tags:** rating, elo
  
  > **Comments:**
  > **username_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.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_6 on 2016-08-15. Score: 10 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: so how do you calculate elo change after calculating the expected outcome for each player? what happens in the case of a stalemate?  
  > **username_6**: 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.  
  > **username_0**: That's the part i was missing.  
  
  ---
  
  ### Answer by username_2 on 2016-08-11. Score: 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.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_2**: Yes, it should be working.  
  > **username_0**: I will try this, however i am still open for new suggestions  
  > **username_3**: @username_0Fowler 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.  
  > **username_0**: This is an internal rating system, it is not intended to compare with other systems in any way.  
  > **username_4**: If you're just looking for an internal rating system to compare players in your closed player population, implementing your own version of the FIDE system should work well.  But if you want an idea of why the formulas are the way they are, you should read Elo's book.  It's actually pretty interesting.  https://www.amazon.com/Rating-Chess-Players-Past-Present/dp/0923891277  
  > **username_0**: @username_4 looks interesting  
  
  ---
  
  ### Answer by username_5 on 2016-08-17. Score: -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.
  
  > **Comments:**
  > **username_6**: 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. http://chess-results.com/tnr209009.aspx?lan=9&art=9&fed=ESP&turdet=YES&wi=821&snr=3). 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.  
  
  ---
  
  