I am working on a programming exercise that has interested me for some time. The goal of this exercise is to generate a softball schedule for a seasons programatically. What I am looking for is general advice rather than a specific anwser as I am trying to learn something in the process.
The part of the program I am really struggling with is how to generate all of the games that are played in one night. This is the basic functionality I am trying to achieve in the first interation.
Problem:
Given a list of teams, generate a schedule that has every team play 2 games, and no team can play the same team twice in one night.
I went with the implementation that I found on Wikipedia for Round Robin
http://en.wikipedia.org/wiki/Round-robin_tournament
The standard algorithm for round-robins is to assign each competitor a number, and pair them off in the first round …
… then fix one competitor (number one in this example) and rotate the others clockwise …
… until you end up almost back at the initial position