Thursday, March 27, 2008

How do you create a round-robin schedule?

April 2008 - This year we've added two more teams, for a total of ten, to the golf league I run. Being our regular season is fourteen weeks, putting together a round-robin schedule in the past for eight teams was pretty easy. Each team plays each other twice. Now that we have ten teams, cramming us all in fourteen weeks is a bit more difficult.

I spent a few hours trying to figure out how to setup a round robin schedule. After frustrating the hell out of myself, I broke down and asked Wikipedia. The first search I ran, gave me the algorithm that I needed.

Thinking back on it, it's actually pretty simply. I started by creating a spread-sheet and matched up 1-2, 3-4, etc. Then I simply held the "1" team constant, and used the algorithm to rotate each team around in a circle. It looked something like this as I went through.



If you do this nine times, each team of the ten will play each other. When you do it the tenth time, you'll find yourself back at the beginning. Finding this exercise fun, I simply followed the algorithm a total of fourteen times to give us our regular season. That means each team will play each other once. Then you'll play five other teams twice. Not ideal, but it works.

Once I had the schedule in place, I had to assign team names to 1, 2, 3, etc. I thought about drawing numbers out of hat like last year, but my wife was uninterested in helping me out and when trying a sample drawing with my seven-month-old son, he started to eat the numbers. Being I've spent a significant amount of my career and education working with technology, I fired up the spread-sheet program again and used a random number generator to rank the teams. Mentally Handicap came in at the lowest (0.378373293) which made them team "1". Brad Smith's new team, Missing Links, was the highest (9.788895237) and thus was the "10" team.

At this point I needed a cold beverage to celebrate. As I cracked a cold Surly, my wife said "why does the "1" team always golf first?" She had a point; our tee-times needed to be ranked. To do this I went back to the random number generator and created a ranking for each week. The lowest random number got the first tee-time (3:44) while the highest got the last (4:48). Now you'd think that a random number generator would equally space each team so we don't have the same teams always teeing off at the same time. Apparently this is tougher than expected though so I had to manually adjust five to six times so that we didn't have Noonan! teeing off at 3:44 every week.

After ranking the tee-times, I started sipping on my Surly, admired the creation and started thinking about all the shots I plan on shanking. Happy golf season!

No comments: