in reply to Re: league games schedule algorithm
in thread league games schedule algorithm
But then I can't use the round robin algorithm, and would have to create a new one to complete the schedule.
I'm thinking that having the teams diagonally opposite on the original round robin might be the best way because then they only overlap for one game as both home, minimising the number of games that will need changing - ie, for:
H A ===== A v B C v D E v F G v H
teams 'B' and 'G' would be the ones from the same venue
Once again, trying to rewrite the question has provided a solution (I think). Here's my stab...
A solution exists for all cases where at least 2 teams are not subject to the restriction.
Let's take the example where there are 8 teams (A-H)
Here's a sample schedule created using the round robin algorithm, home team listed first (for half the league, the second half is the same, but with home/away reversed)
A B A C A E A G A H A F A D C D E B G C H E F G D H B F E F G D H B F C D E B G C H G H H F F D D B B C C E E G
Now let's assume that teams A and H don't have to worry about playing at home or away each week, but that the others do, and they are paired at the same venue as follows:
B & G D & E F & C
When an instance occurs where two teams appear on the same side, simply swap the 'A' game around. So for the schedule above, it would become:
A B B A E A G A A H A F A D C D E B G C H E F G D H B F E F G D H B F C D E B G C H G H H F F D D B B C C E E G
ie, swap the first game order around for half the 2nd to 4th games.
Assuming this extrapolates, I think I have my solution.
Now all I have to do is write an algorithm to rewrite the league schedule when some games have played and 2 or more teams decide to drop out...(sigh)
cLive ;-)
--
seek(JOB,$$LA,0);
|
|---|