Link to home
Start Free TrialLog in
Avatar of mSchmidt
mSchmidt

asked on

Team assignment code, for a Tournament program

Okay what i have will be either 4,6,8 or 10 teams which are going to play either 1, 2 or 3 times agains each other.

What i need the algorithme to do is pair these teams into matches something like

Home vs Away
T1     vs     T2
T3     vs     T4
T5     vs     T6

If one round is chosen each team has to play each other team ones, if two round each team has to play each team twice and so on.
Now the tricky part is that each team should (as much as possible) have the same number of Home and Away games. (meaning one team cannot play 5 home games and 3 away games)

Does anyone have a nice example code for this ?

ASKER CERTIFIED SOLUTION
Avatar of str_ek
str_ek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mSchmidt
mSchmidt

ASKER

Lovely answer worked out just perfectly ... !!
If i could give you an A+ i would

Thanks
Hey i just opened yet another question, seems my situation is not completely solved i hope you could take a look at my new situation, a bit more complex iam afraid

https://www.experts-exchange.com/questions/21115036/Advanced-all-versus-all-match-assignment-algorithme-creating-matching-so-all-teams-always-can-play.html