Soccer tournament, partitioning games
I've this very difficult problem which I can't solve so I really need your help. I don't know if this will be a clear explanation because I'm Dutch but I'll try..
I have this tournament which is devided into several poules. Each poule has a user given number of teams (ex: Poule 1: 4 teams, Poule 2: 7 teams, Poule 3: 6 teams). Each poule plays a half competition, which means that they play against eachother 1 time. In a poule of 4 teams this would mean the following:
Round 1 Round 2 Round 3
Team 1 - Team 2 Team 1 - Team 3 Team 1 - Team 4
Team 3 - Team 4 Team 2 - Team 4 Team 2 - Team 3
I can set this up for a poule with 4 teams, but with 5 and higher I can't. I don't see the logics and I don't feel like putting all schematics in and not find any formula.
A simple way to 7 teams per poule
Actually, I just discovered a simple analytical way to do it. First u have to find all the combinations in a really simple method. I will use 4 teams in a poule as an simple example to illustrate. Then proceed to 7 teams a poule to show that it is really easy to pair the teams in a tournament.
Now, how to find diff combinations(before we can pair)
=======================================
In this example, each team have to face the other 3 teams eventually. Let us have the combination for A.
A B
A C
A D
Let us add in the combinations for team B now. Pls note 1 combo is in the above already.
A B
A C
A D
B C
B D
Let us add in the combinations for team C now. Pls note 2 combo are in the above already.
A B
A C
A D
B C
B D
C D
Part 1:Using the same method to find combo for 7 teams in poule
==============================================
Being a kind person I am, I will do a walkthough with u.
7 teams in a poule: A B C D E F G
A B
A
A
A
A
A
B C
B
B
B
B
C D
C
C
C
D E
D
D
E F
E
F G
Now fill in the 2nd column with alphabets that began after the ones I put in.
A B
A C
A D
A E
A F
A G
B C
B D
B E
B F
B G
C D
C E
C F
C G
D E
D F
D G
E F
E G
F G
U got the 21 diff combo
Part 2: We can do the pairing now!
=========================
Note: I have to use the code tags to keep my alignment intact.
Note: For my own convenience, I will call the 1st column began with the same alphabet, seg or segment. Eg, seg A and seg B.
Do the 6 days, ignore day 7 for now.
Code:
day1=A B
day2=A C
day3=A D
day4=A E
day5=A F
day6=A G
B C
B D
B E
B F
B G
C D
C E
C F
C G
D E
D F
D G
E F
E G
F G
For day 1, we had "A B", look for another matching. Since B is in "A B", we need not look in seg B.
Suppose we choose "C D", we still got to look for another match. Since D is in "C D", we need not look in seg D. Let us choose "A B", "C D" and "E F" for day 1.
Code:
day1=A B
day2=A C
day3=A D
day4=A E
day5=A F
day6=A G
B C
B D
B E
B F
B G
day1=C D
C E
C F
C G
D E
D F
D G
day1=E F
E G
F G
Do the same for the other days.
Rule of thumb:While doing pairing for each day, do not look in seg for which the found matches already contains the alphabets. Eg,looking the third match for "A E" & "B F", u need not look again in seg A seg B, seg E and seg F, proceed straight to seg C or seg D.
After u have paired for the 6 days, the remaining 3 un-paired matches would be for day 7.
Code:
day1=A B
day2=A C
day3=A D
day4=A E
day5=A F
day6=A G
day3=B C
day2=B D
day5=B E
day4=B F
day7=B G
day1=C D
day6=C E
day7=C F
day4=C G
day7=D E
day6=D F
day5=D G
day1=E F
day2=E G
day3=F G
Voila! u have all the pairings.
Code:
Day1 Day2 Day3 Day4 Day5 Day6 Day7
==== ==== ==== ==== ==== ==== ====
A B A C A D A E A F A G B G
C D B D B C B F B E C E C F
E F E G F G C G D G D F D E
G F E D C B A