It was 6 p.m. on a Thursday and the office was getting empty. I walked to the common area and saw the lonesome ping-pong table waiting patiently. “Who is the best nowadays?” I wondered, “Who all even plays?”
I began to think of ways to keep track of games, and scores, and preferably rankings. Paper and pencil seemed dated. Using some app seemed heavy handed since I’d have to get everyone to use the same one. “What is the most lightweight way to get people to track their games?” I thought. The way most games originate is by calling out someone in Slack or just asking if anyone wants to play.
Often the discussion would go back and forth a bit about being too busy, or new players figuring out how good others were. Wouldn’t it be nice if all this were automated, and done so directly in Slack?
As a former chess player I was quite fond of Elo’s scoring system. The premise there is simple: everyone starts with a default rank and gain or lose points based on who they play against. If you play someone who is much better than you and lose — you barely lose any points in your rank. If you win vs someone who is much better — you gain a lot of points, and they lose a lot! I’ve wanted to introduce this system to our ping pong games, directly as part of the conversations. Here’s how I did it via our bot “Mr. Rogers” powered by the Alphabot engine.
When someone wants to take on a challenge the easiest way to accept it, even easier than saying yes, is to click a button. Slack makes it convenient by providing “interactive-messages” as a feature. The activation keyword I chose is !challenge (we have a convention for bot commands to begin with !), and the rating you see below is the Elo score.
Everyone in this Slack room can now click the button, and the first one to do so will claim the spot in the competition! To prevent further confusion, the alphabot engine removes the buttons and replaces it with information about who clicked it, which button was clicked (in case there is more than one) and adds a timestamp:
Along with the changes above Mr. Rogers gives some new information. A new interactive message is provided, this time with four choices of the outcome of the match:
Selecting one of the names will increase that person’s score and lower the other person’s score.
From the graph above — if the difference in scores is huge (600) then the expectation of win is high, and therefore % of points to earn is low. However if the difference is in the opposite direction (-600) then then expectation to win is low — and % of points to win is high.
When ranking entered the scene, everything changed. Discussions around the ping pong table and on Slack were no longer “she’s good” or “I’m about same as him” — it was all in the data. This made everyone curious about their standings and more people started participating. As per huge demand — a coworker quickly wrote another Mr. Rogers script to display the leaderboard. In less than a week we had over 15 participants, compared to 6 before. Two weeks, and another coworker decided to organize a company-wide tournament; it has become a 32 person bracket! (Hat tip to challonge.com) So how did this code ignite such a change in our attitude toward pingpong?
The real change was of course not because of the specific lines of code, but because an action that people already liked was made super simple, and a level of gaming competition was added. I loved this project because it brought together two things I’m passionate about. To me, bringing together software and cultural impact is like bringing peanut butter to jelly.
How 72 lines of code can impact your company culture was originally published in Nextdoor Engineering on Medium, where people are continuing the conversation by highlighting and responding to this story.