Sunday, May 14, 2006

NBA Playoffs

Rob's running a pool for the NBA playoffs. They started about 3 weeks ago, and last until sometime in June. Part of the fun of March Madness was watching our relative standings in the pool updated almost live. ESPN did it all for us. So when Rob started the pool, he called me up and asked how much work it'd be to make such a website. You see, ESPN doesn't have one for the NBA. I said it'd be a few hours of work, but I didn't commit to doing it.

This past week I've had a little extra time on my hands. The result is here. There are a few things I still want to do:

  • PPR! As you can see from the table, there's a spot for the possible points remaining. The scheme for awarding points makes calculating PPR somewhat more complicated than it might seem at first glance. A correct pick gets 2, 4, 8 or 14 points depending on the round plus 4, 2, 1 or 0 points depending on how closely the series length is predicted plus an upset bonus if applicable. The upset bonus is awarded when there is an upset, i.e. a lower seeded team wins. The upset bonus is the difference of the seeds. This is what makes it tricky! It's entirely possible that someone can maximize his points by losing a series one round, in order to get the upset bonus in the next. One has to take this into account to faithfully calculate PPR.

  • Automatic updates! The whole point of this thing was to make both Rob's life and my life easier (in the long run). I haven't yet written the script that will update the database. This is actually a pretty simple step thanks to AJAX. I remember back in the day when I might have to screenscrape to do this. But now every website has a nice XML feed so AJAX can automatically and asynchronously refresh its webpages.

  • Game progress! When I write that background script, I can get more information than the series tallies the database currently holds. I can follow individual games (scores and the like) and display these on the page. Of course, this means I should also use an AJAX-style refresh, to keep those updates coming. (Knowing the upcoming schedule will also allow for better caching!)

  • Clean code! I did this rather quickly, so it's a little messier than it has to be. It'd be nice if it were a bit more intelligible. The files so far total over 800 lines. Isn't that a kick?



I can now run a pool every year! Hah.