Tuesday, December 18, 2007

Simulation Remake...yay!

About 13 +/- years ago, a group of four enthusiastic geeks set out to create a computer simulation of an NCAA basketball game as a project for their business math analysis class (lovingly abbreviated as "anal bus math"). The goal was to simulate that year's Iowa vs. Iowa State basketball game prior to the event, and compare the simulation results to the actual outcome. This would serve as a measurement of their ultimate success (i.e., their grade).

The Geeks
Jerry, Norm, Corey, Me

The Project
Programming Language: Applesoft BASIC
Computer Hardware: Apple IIe and Apple IIGS
Workhorse Programmers: Jerry and Norm. Corey and I were familiar with programming basics, but Jerry and Norm were the real experts. We helped where we could, but ultimately the workhorses pulled the majority of the weight. Not that it probably would have made much of a difference in the ultimate workload sharing because Jerry and Norm were obviously more equipped to do the work, but the development environment with BASIC was not very conducive to multiple programmers. It wasn't like the object-oriented languages of today, where you can easily break off chunks of the code to be put in separate modules and coded by separate people. I suppose we could have done that, but it would certainly have been a lot more cumbersome.

The Results
Unfortunately, the program was not finished prior to the Iowa/Iowa State game, but it did end up getting finished. I don't recall exactly how close we actually got to the final score, but I seem to remember it wasn't too far off. Of course, we already knew the final score, so I'm sure we tweaked our code a smidge here and there to get reasonable results. Doing so was not necessarily a bad thing, even though we were being graded on the results, as calibration with the real world is definitely needed for something like this. Plus, it's not like we stole the answers - everyone (including the teacher) recognized that working backwards to the solution was an available option.

In the end, we presented the program to our class, and a math class in a neighboring town (Cascade - "The Mecca of all learning and knowledge" according to Mr. Strang). I think we ended up with an "A". If we didn't, we should have. ;)

The Remake
It's not known what eventually became of the masterpiece we created. It's probably sitting in a box somewhere collecting dust in one of our parent's homes; the disk surely succumb to failure. So sad.

In late 2001, I set out to recreate the masterpiece; this time using Visual BASIC 6. I plugged away at it here and there in my spare time, and finished the basic logic of the program sometime in late 2002 or early 2003. It has sat dormant ever since. I've decided now is the time to finally finish it -- hopefully, before March Madness 2008.

In it's current state, it is hard-coded with the stats from the 2002 National Championship Game between Maryland and Indiana, which I used as a start for the underlying calibration of the code. Certainly more calibration is in order. This makes it quite tedious to simulate other games, as it requires delving into the code itself to input new statistics; a fatal flaw suffered in the original code as well. The last major task at hand is to implement a database backend for storing all the statistics, making it possible to easily input and edit statistics and simulate a game between any two teams, with the ultimate goal being a simulation of the entire NCAA tournament in one fell swoop. Now that would be sweet...

I hope to post updates of my progress now and then, but we'll see how that goes. In the meantime, here's a quick video of the current program:



As of right now, it can simulate 100 games in about 5 seconds (10 seconds if the line-by-line results are chosen to be displayed). Definitely a LOT faster than the original, which I think took about 20-30 minutes for just one game, if I remember correctly. The increased simulation speed is certainly more a result of faster computers moreso than better or more optimized code.

No comments: