Recently one could find a new achievement at our meetingpoint called the “gym”: a ping pong table! For many years, two professional soccer tables were the highlight in the lunch break and after work - now table tennis is up to date and heated duels are delivered very frequently. Cool thing, but we have not yet been able to clarify an important question:


Which Scandian owns the crown of the best table tennis player?

Tournaments are probably not a good idea in times of Corona. And so, during a pleasant evening chat, the idea of a ranking system was born, where the daily individual games can be entered and thus the ranking is created over a longer period of time. Bitten by ambition, we also started directly with the conception and implementation.


The concept

As a result of the conception we decided to use a Slack bot, because we use Slack for internal company communication. As an MVP (Minimal Viable Product) it should be possible to enter single games and view the current ranking at any time. Everything else, such as player pairings or number of games, should be left up to the individual.

Each time a game result is entered, the ratings of the players involved are to be adjusted based on this result. Since there are already renowned algorithms for exactly this purpose, which also take into account how strongly the players are currently rated, we have decided to use the Glicko-2 algorithm, which is known from chess, for example.


Glicko-2

Instead of assigning a single number as a rating to all players, Glicko-2 also determines a Rating Deviation (RD) and a Rating Volatility for each player. The Rating Deviation is a measure of the uncertainty about the true rating of the player and corresponds to a standard deviation. This is quite high for new players and decreases with an increasing number of games, but increases again after inactivity. The rating volatility, on the other hand, quantifies fluctuations in playing strength. Ratings are then updated on a round-by-round basis. Since some colleagues play much more frequently than others, we have based our approach to the grouping of matches on the one by Online-go.com. Now we have to collect game results over a period of time to be able to calibrate the parameters of Glicko-2 so that we get the best predictions about table tennis matches.


The implementation

The first executable version of the bot was deployed the same day at midnight. Basically a small API written in Python (Fast API) and PostgreSQL for persistence was implemented and hosted in the AWS Cloud. In Slack only a new app had to be registered, which communicates with our API. This resulted in two new commands for the Slack users:

/pp : Opens the dialog for entering a new game result

/ranking : Opens the overview of the current ranking list

Conclusion

The bot has been very well received by the Scandians and they play hard and measure themselves against their colleagues. Although there is nothing to win, there is a little competition going on for the first place.

➡️
Click here for another Scandio internal project that makes our everyday life easier: ShipIt Days 2020 Winner of Innovation - Virtual Office goes live

💡