Sunday, September 13, 2009

Ruby is a Bloodsport


8th Light's 2009 ruby sparring tournament was posted at the end of August, but I just heard about it last week. I followed the simple instructions for getting started and was quickly rewarded with a very cool limelight app that drives the code you write. The coolest part of the app is that it analyzes your player and assigns a score. The score is based on efficiency, lines of code, test coverage, various metrics and of course how well your player does at hangman. I was immediately sucked in to the fun and challenge of the problem and I have created and refined my own player and submitted it for entry in the tournament. I thought I would share a few of the things I learned that might help others improve the scores of their own hangman players.
  1. "Simplicity Score" depends on lines of code, including comments, so delete all comments from the code to maximize your simplicity score.
  2. "Flog Score" is an easy one to maximize. Run flog separately on your code. Anything with a flog score above 9 will cost you points. Refactor bigger methods to smaller ones to keep their flog score below the limit.
  3. "Time Score" can be tricky to maximize. One approach is to create a performance test to help drive out the bottlenecks in your code. The hangman uses a list of 10,000 words so any time you iterate over that complete list you kick holes in performance.
Those were the 3 biggest things that helped me get my player score up there. It was definitely lots of fun and a good way to sharpen skills. I'm looking forward to seeing how the tournament plays out. Drop me a line if you wanna talk shop on this. Hope you decide to join in. And a big thank you to the folks at 8th light for making this happen.

No comments: