How to Win on Jeopardy! With Ruby on Rails
So hey, if you’re one of the hundreds or so people that my family or I told to watch Jeopardy! last night, you saw that I won a close game against Jeopardy champion Monica Lenhard. It was an amazing, exciting, nervewracking and fun experience!
You pretty much only get one shot to be on Jeopardy!, so I was dedicated to preparing myself in the weeks before I got behind the podium. I played along with all the episodes I had on my digital TV recorder, pausing at the end of each question and keeping score on paper. Then I thought, hey, there’s an amazing website, j-archive.com, that has the record of countless games, and I’m a web programmer who uses the sweetest web framework ever, Ruby on Rails. I’ve got to make my own training setup!
So here’s what I did in a day and a half one weekend – just skip this part if you’re not interested in the technology. I put together two of the most useful Rails plugins, Mechanize (which uses the fantastic Hpricot parsing library) and attachment-fu. I was able to download and parse the games from J-Archive using Mechanize, and show the clues’ pictures instantly using attachment-fu. It only took 244 lines of Ruby and some Javascript to make it all work.
With this setup, I was able to pick my own categories, have my patient wife read the clues, stand back and click my clicky pen at the right time. Since it was all on the computer and based on actual games, I could see at a glance how I was doing, stop at any time, compare my scores to the actual contestants, and get a better sense of the flow of the game.
It kept score without regard to Daily Doubles, known as a Coryat score among the Jeopardy fans. This makes the score more comparable and predictable. The main page I went to was a list of the games I had played, which let me keep track of my progress.
For the benefit of future potential contestants who want a benchmark, here are the scores I got in my practice sessions, with both the number of questions I got right and my Coryat score for each. The total numbers next to them are the number of questions that were actually seen and the total value of the questions contestants got right in that game.
Did I go too far? Well, it took less than a weekend to write and was fun, so I would say no. And it really helped me get a feel for the game. Having been on the show, I now think it was even more useful than I thought it would be. I can definitely say that Ruby on Rails helped me win on Jeopardy!
