Thursday, May 20, 2010

Passer Rating App



When Dallas Braden pitched his perfect game a week or so ago, the NFL Network celebrated that achievement by counting down the top 10 perfect Passer-Rating games of all time. This, of course, begs the question just what is a perfect Passer-Rating game anyhow?

Of course, this doesn't mean no-sacks, no-interceptions, no-incompletions, and no QB penalties (such as intentional grounding) as I think it should. I think we would still be looking for that first perfect performance if such was the case.

Rather, a perfect passer rating is defined by the passer-efficiency formula. There is a hard-cap of 158.3 on that formula, but it is not imposed by the formula. It's just imposed by rule. You can read these formulas here.

Fran Charles showed us the formula on screen and declared "If you can understand that math, you have a large amount of money in your future." Not being a man given to math anxiety, I wanted to have a good look at it, so I hit the pause button. 'Twas nothing! The formula is piece of cheese cake with some cherry sauce.

When I saw that, at around 12:30am in the morning, I had to fight the urge to flip open ye old laptop and scribble some code. I figured I could code it in under 20 minutes. I had some down-time at work this morning, as per usual, and I decided to give it whirl. The class which does the calculation was trivial. It was more effort to rig the WPF test form than the class which calculates the formula.

Just 75 lines of code, no mas. It could have been smaller and more compact, but I decided to put in some luxory items, like the NCAA passer rating formula, and the passer's first name and last name. I didn't have to do that. There it is in nice shiny Microsoft C# 4.0 code.

Grad total of effort: Maybe an hour and a half. It could easily be converted to Java in 20 minutes or less. Mayhaps I will do that with NetBeans tomorrow. Same goes with Visual Basic.

So I suppose the main question is this: Does NFL.com have a WebService API and can lock-on to and feed my app. I can do real-time passer ratings with this app if I take it a step or two further. It would make a nice Google Android app.