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
225 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now