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...

solution

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);


In reply to Re: league games schedule algorithm by cLive ;-)
in thread league games schedule algorithm by cLive ;-)

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.