
Previously, our workflow was interrupted due to a number of unresolved issues:
- And which of us plays table football the best?
- Who should I go play with now?
- Who should be fired, because he does not work and only plays?
Our experience in solving these issues using the Elo rating system will be discussed in the article. As well as a link to the repository and the site will be scattered on the article.
When a company is small and there are even fewer players, the best question is solved by simply holding a tournament on Friday evening every two months. <advice> A chic reason to drink at the company's expense. </ advice> (We were not immediately understood because of inexperience. And at first they just played like that.) But the company is growing, the league is also increasing, and now we have to play the tournament group, it becomes very difficult. It’s just physically hard on a big football table to have 15 games per evening.
At this stage, experienced
players in online games of 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 receives a rating of 1400. In fact, it does not matter how much. At the end of each match, part of the rating goes from one player to another. And so as not to go into the minus is taken initially with a margin.
We assume that player A gets 1 point in case of a win, 0 in case of a loss, and 0.5 in a draw. Let's 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 are the current ratings of players B and A, respectively. Ea belongs to the interval (0, 1).
The coefficients are chosen in such a way that, with a difference in the rating of 200 points, the expected number of points is approximately 0.75. New player rating A is calculated according to the formula:
Ra '= Ra + K * (Sa - Ea)
where K is a coefficient. This is the maximum number of rating points a player can gain / lose in one game. Usually equals 16. FIDE depends on the level of players and varies from 10 to 30.
Similarly, the second player's rating 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 is clear from the formulas that a strong player gets a lower rating for defeating a weak player than if a weak player wins a strong one.
We have been using the rating for about a year. We played more than a thousand matches. In my subjective opinion, the rating reflects fairly accurately the placement of players at the current time. As soon as someone in the company starts to play better, for example, having mastered the strike, within a week takes an appropriate place in the rating.
It is also not a problem if the results have not been recorded for a week or two. Upon renewal, the rating is quickly restored.
After the introduction of the rating, the behavior during the game changed greatly. Matches have become more spectacular. If earlier, having missed a couple of balls in 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 donate to the opponent) rating points! The author of the article recently lost 1: 6. And won 7: 6. It was a hot match.
Naturally, when we decided to try the rating, we first looked for ready-made implementations. And although many online games use Elo, they did not find anything sensible, where we could just record the results of our games. Therefore, a google-script for google-docks was thrown on Friday evening.
Half a year ago I wanted to look at the Asp.Net Core in action (then RC1 was). And objectively google-script has long been missing. And there was just the weekend. As a result, a rating system has emerged, which we have been successfully using so far. We like. I'm sure, and the rest may be afraid to admit that they are not.
I think it will be right to share with everyone. Sources are available
here .
It turned out that something is clearly more than just MVP. Including now implemented:
- Elo rating calculation;
- Additional statistics: the ratio of victories, scored / missed, victories and defeats in a row;
- Scoring points earned / lost in case of win / loss 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. This is where we moved from google scripts;
- Authentication with OAuth support. So far, only google, as we have enough. But it’s easy to add which system;
- Simplified system of access rights. There is an admin league with the ability to manage the league and just players;
- Inviting new users. With email notification;
- Separate leagues. Each user can create his own private league, which will be visible only to league players;
- Support 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 extra natural. Just Bootstrap. To conveniently bring the results from the phone;
- Should work with javascript off. It is more convenient of course with the included. But since there was a desire to look at some MVC features, it turned out to be a multipage application.
During development for hosting, I used Azure. Being sure that 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 with the migration of the database, and then the project did not start, because the hoster was not very ready for Asp.Net Core, I had to stay on Azure. But the price tag is big there. On the other hand, there is something to compare, Azure is much more convenient.
The advertisement on Habré about hosting Azure for startups was remembered. I read the conditions. I wrote a complaint letter to the specified email. And the project added to the program of support for startups. Hopefully, after the article will not exclude. Although I believe that the project satisfies all 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 established experimentally that the name is not very memorable. Therefore, we have decided to use learningstreet.ru by a general vote.
The exciting story of why learningStreetA long time ago, one of our colleagues, milling the signature to the letter, wrote for the joke the address of the office as learning street 79 (Educational Street). We laughed. And literally a day later, I called a number of guys “boys with whom we work” (in a negative context), and not friends. Word by word, the quote from the hero of the movie The Wolf of Wall Street was recalled: “This is Wall Street. There are no friends here. ” Which was modified to “this is Lening Street. There are no friends here. ” Since then, if someone thinks that the world is unreasonably cruel to him within our office, we remember about Löning Street. That is every day. Actually, we do not have friends in the football ranking either, and we should not expect mercy.
Theoretically, if anyone has ideas of domain names suitable for the site, you can fasten. I just have bonuses from one of the hosters.
Oh yeah, I almost forgot. Who should be fired? Apparently me:
