Wednesday, April 06, 2016

The Brackets Project

Inspiration for projects come from everywhere. Today there was a lot of talk about “March Madness” or the NCAA Men’s basketball tournament. It got me thinking about how to write a program to fill out a bracket. Since I have been thinking about randomization lately (did you see my post about the expensive TSA project?) this idea fit right in.

Purely random wouldn’t work because the odds are not even. Sure any team could win on any given day (Michigan State losing to Middle Tennessee this year threw a lot of people for a loop) chances are that the higher seed is going to win. So I decided to weight the random factor. That means I have to keep track of the name and the seeding value throughout the effort. Ah, great, an excuse to create a class.

After that the hard part was creating a form to display the results. That is were I spent by far the most time. And yes it could still be a lot nicer. I’m a programmer not a graphic designer!

My current thought is that this may make a good project to finish the semester for my one semester programming course. Done right it incorporates a user created class, arrays of objects, loops, decision statements, a number of methods both in the class and in the program, and generally everything we manage to fit in one semester. It’s complicated enough to test beginners and yet simple enough for them to finish in a few days time. (I’m pretty sure it will take them more than the hour or two I spent on it.)

brackets

BTW it took me a number of tries before the program picked Villanova as the winner.

No comments:

Post a Comment