If there's one thing we love at Foundry, it's tech. If there are two things, they're tech and pool. The literal centerpiece of our office is our beloved pool table. At 4pm the table is open and occupied until the last of us leaves. Around the table people watch matches, inside jokes are born, designers and engineers talk through work, and yes, whisky flows. But for some pool is also a great source of pride. Beating a top player like Jason or Steven or Nils is an accomplishment and can only mean that the tides have finally turned.
No one can quite remember how Fast Eddie was born, but I like to believe that one day a top player was beat and after a proper heckling from the crowd some engineer said they could prove who was better with math.
Enter Foundry's resident elder geek and pool shark, Nick Colgan.
After some research Nick decided that the ELO rating system could provide the math, Slack could provide the interaction, and this whole thing was a great way to play with some new tech that we hadn't yet found a project for.
ELO is a rating system originally developed for Chess, but it works with any zero-sum game. Each player starts with a rating. In our case, we started everyone at 1,000. Each time a player wins or loses their number goes up or down. The genius of it is that the amount it changes is based on the opponent. So, if a lower ranked player beats a higher ranked player, their number may raise quite a bit and their opponent may lose a lot. On the other hand, if a higher ranked player beats a lower ranked player, their number may only go up a small amount and the loser won't be penalized too much for losing to a player they were predicted to lose to anyway.
So how do we make this into a thing? The basic plan was about as pragmatically "MVP" as you'd expect from a seasoned engineer. A Slack app was made to accept results of games and report the updated stats. An Elixir backend handles marshalling around the data which is stored in a Postgres database. Since ELO is a common algorithm, the math could be done on demand at pretty much any step.
Once a game is played, the victor records their win by running /report in our #billiards Slack channel. Fast Eddie asks if it was 8- or 9-ball, who the opponent was, and who won. The match is stored in the database and the updated rankings are calculated on the fly.
The Slack integration was great for getting a snapshot, but pretty quickly people wanted to see more data. So Nick turned to our favorite UI tools (React, Chart.js, etc) and built out a lovely dashboard. Interestingly, you can see when we closed our office, and when we allowed for limited numbers to return.
We wouldn't be us if we didn't sit back and ask: did this fulfil our dream? In a way, yes. We have some neat new tech to play with. All in all the system has been the very definition of stable. People can finally point at something and at least pretend that the statistics are real. But, I think most of us would agree that Nils holding the #1 spot isn't what we'd hoped for.