Background
The sports club in which I participate asked me for help in supporting IT for the upcoming contest.
The competition consists of teams of which the exact number is not necessarily known until the day of the competition. Consequently, the need for software support.
All teams will meet with each team. in the number of matches . Thus, the number of matches is N more than 2 (all combinations of 2), where N is the number of teams.
We have an unknown number of ships available to play matches. This number will probably be 1 or maybe 2, but I would like a general solution.
The competition will be held in revs . At each turn , one match will be held in each court .
For example, if there are two courts and five teams (A, B, C, D, E), the layout of the U-turn might look like this:
Turn Court 1 Court 2
--------------------------------
1 A vs BC vs D
2 A vs CD vs E
3 A vs DB vs E
4 B vs DC vs E
5 A vs EB vs C
Problem
My problem is to find an algorithm for generating a lot of turns that obey the following simple rules:
- All teams must meet with all other teams exactly once during the competition.
- A team cannot play two matches in the same move (i.e., it cannot play simultaneously in court 1 and 2).
- The turns that a particular team plays must be distributed throughout the competition.
Detailed Rule 3
Rules 1 and 2 are pretty simple, and I already have a solution for this. This rule 3 gives me problems. I will try to show what this means:
Let's say I have 5 teams (as indicated above), but only 1 court. There are 10 matches in 10 turns. One possible layout is
Turn court 1
1 A vs B
2 A vs C
3 A vs D
4 A vs E
5 .
. .
. .
ten .
In this case, A plays the first four matches, which are not fair, since they have no chance to restore their energy between games. I want to avoid that.
Ideas?