Solved

Have 4-10 teams need to create game rounds, where each team gets to play against each other from 1-3 times

Posted on 2004-08-30
6
227 Views
Last Modified: 2010-04-17
Hi
I have a program where the user may choose from 4-10 teams and then choose how many times these are to play against each other (1 - 3 times)

So the first round could be
Team 1 vs Team 2
Team 3 vs Team 4
Team 5 vs Team 6

now the thing is that the algorithm i want should make sure that all teams play against each other the chosen times and that each team should have equally many Home and Away games, left and right in my example... Does someone have a fast example of how this can be accomplished ?
0
Comment
Question by:mSchmidt
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 11936587
6 1
5 2
4 3

6 2
1 3
5 4

6 3
2 4
1 5

6 4
3 5
2 1

6 5
4 1
3 2

I hope you see the pattern
0
 
LVL 5

Accepted Solution

by:
rsriprac earned 500 total points
ID: 11937555
A way to visualize it is this (I'm not sure if I'm getting the questiong correctly tho):

If you have X teams to play each other Y times, this is called a "complete graph" (http://mathworld.wolfram.com/CompleteGraph.html).  Where the X is the number of dots on the graph, and the Y is how many times you repeat the drawing the graph.

Lets number the dots 1 ... X.  So to form this graph, we pick a starting dot, lets pick 1.  1 will play all the other team first (exclude it self), i.e. (1,2), (1,3), (1,4), ... (1,X).  Now its 2's turn, since they already played team 1, then we start with (2,3), then (2,4), (2,5), ... (2,X).  Now its 3's turn, and since they played team 1 and 2, then they play: (3,4), (3,5), ... (3,X).

This will make sure that all teams play each other.  If Y >1, then you just re-run the about Y times.

-Ram
0
 
LVL 3

Expert Comment

by:Stimphy
ID: 11938502
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:mSchmidt
ID: 11939498
The complete graph does not take into account the amount of home and away games which the teams will play,

Which is a very important issue in this calculations, as i see it the latin Squares do not take this into consideration either...
0
 
LVL 84

Expert Comment

by:ozo
ID: 11939722
When there are an even number of teams and an odd number of times play against each other, each team will play an odd number of games, so they can't have equally many Home and Away games.
With an even number of times to play against each other, they can just play half the games with one team at home and the other half with the other team at home.
0
 

Author Comment

by:mSchmidt
ID: 11940005
With an even number of teams and an odd number of round each team will as you say play an odd number of games but this does not mean that T1 in the last round should play all its games on the Home (left side), even though this would result in T2, T3 and T4 only having played one game additionally on the Away lane, it resulted in T1 playing 3 games on the Home lane.

Going back to my first question i would like an example of how this could be coded ( in for instance VB 6)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 101
groupNoAdj 7 95
How does Google get such fast response times? 5 176
printf performancy 11 35
A short article about a problem I had getting the GPS LocationListener working.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question