Back to Home

Elo rating in games for two players

elo · rating · asp.net core · games for two · elo

Elo rating in games for two players

    Previously, our workflow was interrupted due to a number of unresolved issues:

    • And which of us plays table football best of all?
    • Who would I go play with now?
    • Who needs to be fired because it does not work but only plays?

    Our experience in solving these issues using the Elo rating system will be considered in the article. As well as a link to the repository and the site will be scattered throughout the article.

    When the company is small, and the players are even smaller, then the question of the best is decided by simply holding the tournament on a Friday night every couple of months. <Tip> The smartest reason to drink at the expense of the company. (We did not immediately understand this from inexperience. And at first we just played like that.) But the company is growing, the league is also growing, and it’s very difficult to play the tournament, even taking into account the preliminary division into groups. It’s just physically hard to have 15 games per night on a big football table.

    At this stage, experienced online gamers chess players suggest that there is a method for calculating the relative strength of Elo players, which is just used to assess the level of chess players.

    About Elo


    The system was developed by the American professor of physics and chess player Arpad Elo.

    Each new player usually gets a rating of 1400. In fact, it doesn’t matter how much. At the end of each match, part of the rating goes from one player to another. And in order not to go into minus is taken initially with a margin.

    We assume that player A receives 1 point in the event of a win, 0 in the event of a loss, and 0.5 in the event of a tie. Call this variable Sa.

    We introduce the expected number of points (Ea) that player A will receive per game:

    Ea = 1 / (1 + 10 ^ ((Rb-Ra) / 400))

    where Rb and Ra is the current rating of players B and A, respectively. Ea belongs to the interval (0, 1).

    The odds are selected so that with a difference in rating of 200 points, the expected number of points is approximately 0.75. We consider the new player rating A according to the formula:
    Ra '= Ra + K * (Sa - Ea)

    where K is the coefficient. This is the maximum number of rating points that a player can gain / lose in one game. Usually it is 16. In FIDE, it depends on the level of players and varies from 10 to 30.

    Similarly, the rating of the second player is Rb '.

    Obviously, Ea + Eb = 1, Sa + Sb = 1, and therefore Ra '- Ra + Rb' - Rb = 0, that is, we have a zero-sum game. It can be seen from the formulas that a strong player receives less rating for defeating a weak player than if a weak player outperforms a strong one.

    We have been using the rating for about a year now. Played over a thousand matches. In my subjective opinion, the rating reflects quite accurately the arrangement of players at the current time. As soon as someone in the company begins to play better, for example, having mastered the blow, within a week takes the appropriate place in the ranking.

    Also not a problem if a week or two did not record the results. When you resume, the rating is quickly restored.

    After the introduction of the rating, the behavior during the game has changed a lot. Matches became spectacular. If earlier, having missed a couple of goals at the beginning, it was easier to merge this match and start a new one, now there is an incentive to fight to the end so as not to lose (or not give the opponent) rating points! The author of the article recently lost 1: 6. And he won 7: 6. It was a hot match.

    Naturally, when we decided to try the rating, the first thing we looked for was the finished implementation. And although many online games use Elo, they haven’t found anything sensible where we could just enter the results of our games. Therefore, on Friday night, a google script for google docks was uploaded.

    Half a year ago, I wanted to look at Asp.Net Core in action (then RC1 was). And objectively, a google script has long been lacking. And there was just a weekend. As a result, a rating system appeared, which we still use successfully. We like. I’m sure, but the rest may be afraid to admit that not.

    I think it will be right to share with everyone. Sources are available here .

    It turned out something clearly more than just MVP. Including now implemented:

    • Elo rating calculation;
    • Additional statistics: win ratio, scored / missed, wins and losses in a row;
    • Counting points gained / lost in case of victory / defeat when playing with a specific player in the next match. We must somehow plan with whom it is better to play now;
    • Import match results from csv. We moved from google scripts;
    • Authentication with OAuth support. So far, only google, as we have enough. But adding another system is not difficult;
    • A simplified system of access rights. There is a League admin with the ability to manage the league and just players;
    • Invite new users. With email notification;
    • Separate leagues. Each user can create his own private league, which will be visible only to league players;
    • Support for two languages: English and Russian. I have long-standing accounts with application localization. And I really wanted to see how it is implemented in Asp.Net Core;
    • Adaptive design. Nothing beyond natural. Just bootstrap. To conveniently enter the results from the phone;
    • Should work with JavaScript turned off. More convenient of course with the included. But since there was a desire to look at some features of MVC, we got a multi-page application.

    During development for hosting, I used Azure. Being sure that then I will calmly move to some hosting. So be it, even pay it. And he tried to move ... He was even mentally prepared to pay 50 bucks a year for the most modest option. But when I spent the first day migrating the database, and then the project did not start yet, because the hoster is not very ready for Asp.Net Core, I had to stay on Azure. But the price tag is big there. And on the other hand there is something to compare, Azure is much more convenient.

    I recalled an advertisement on Habr about hosting Azure for startups. I read the conditions. I wrote a complaint letter to the indicated email. And the project was added to the startup support program. I hope that after the article they will not be ruled out. Although I believe that the project meets all the requirements. As a result, the issue with hosting is now resolved for 3 years! So if someone does not want to deploy the project locally, join us, create your own league . It was experimentally established that the name is not very memorable. Therefore, we decided to use learningstreet.ru by common vote.

    An exciting story about why LearningStreet
    A long time ago, one of our colleagues, verstally signing the letter, jokingly wrote the office address as learning street 79 (Educational Street). We laughed. And just a day later, I called a number of guys “the boys we work with” (in a negative context), and not friends. Word for word, I recalled a quote from the hero of the movie Wolf from Wall Street: “This is Wall Street. There are no friends here. ” Which has been modified to “This is Lening Street. There are no friends here. ” Since then, if it seems to someone that the world is unreasonably cruel to him within our office, we recall Lening Street. That is every day. Actually, in the ranking of football, we also have no friends and no mercy should be expected.

    Theoretically, if anyone has ideas of domain names suitable for the site, you can screw it on. I just have bonuses at one of the hosters.

    Oh yes, I almost forgot. Who should be fired? Apparently me:

    Read Next