Software development can be draining and often our best ideas hit us when we step away from the problem at hand. When the folks at Braintree need to blow off a little steam, we turn to the ping pong table. We have hardcore and casual players, but almost everyone in the office has enjoyed a game or two.
After the ping pong table had been around for a few months, we decided to have an office tournament. The event was a double-elimination bracket with random seeding. We all had fun, but we left feeling that we needed a more effective way to track our skill levels and provide more accurate seedings for the next tournament. We built elovation to solve this problem.
How Elovation Works
Elovation is a simple rails app that tracks the relative ratings of players in any 2 player game. Getting started with elovation is easy. Just do the following:
- Add a game
- Add some players
- Record your results
The secret sauce of elovation is the Elo rating system, a relative rating system used by the World Chess Federation. All players start with a rating of 1000. A player's rating goes up after a win and down after a loss. The amount that the rating increases or decreases depends on your opponents rating. A win against a higher rated opponent increases your rating more than a win against a lower rated opponent. If you're unfortunate enough to lose against a very low rated opponent, you rating will decrease more than had you lost to a higher rated opponent.
A ruby implementation of Elo already exists, so we built a web interface around it.
On the game page, you'll see a listing of the most recent results. On the right side, you see the players ordered by their ratings. Finally, you can click the "Add Result" button to add a new result for the game.
The player page displays the most recents results for the player across all games. The right side of the page displays the player's ratings for any game they have played at least once.
Elovation is optimized for deployment on Herkou's cedar stack.
First, clone the repo and install the heroku gem.
git clone firstname.lastname@example.org:drewolson/elovation.git cd elovation gem install heroku
Next, create the heroku application and push to deploy it.
heroku create --stack cedar git push heroku master
Because the app doesn't provide any authentication or authorization, you can turn on basic auth by setting a few environment variables in your heroku app.
heroku config:add BASIC_AUTH=true heroku config:add BASIC_AUTH_USER=username heroku config:add BASIC_AUTH_PASSWORD=password
Finally, migrate the app, restart it and open it.
heroku run rake db:migrate heroku restart heroku open
If you've got some ideas for making Elovation better, we want to see them. Fork the repo on github, build your feature and send us a pull request.
Most importantly: remember, ping pong is just a game.