views:

62

answers:

2

I have an even number of teams and I need to create a list of fixtures. The rule is that a team that plays a fixture at home will play the next one away. What do you think is the best aproach for this problem?

So the problem is to generate half of the fixtures, the other will be generated reversing home - away.

So, if I have 6 teams {A, B, C, D, E, F} I need to generate:
Fixture 1
A - B, C - D, E - F
Fixture 2
F - A, B - C. D - E
and so on

Steve is right, it is not possible to implement it the way I said it. But anyway, the question still stands for the fixtures, even if a team will play two consecutive home games.

A: 

Generate all home games first, let every team play one home game versus another team. Make sure that a team won't meet the same opponent twice untill you've had all teams then you're list will be completed. After you've done the home games, you can just switch around the teams and they will be playing away :).

GL!

Younes
That was not the issue. I will insert more details in my question and you'll see.
morsanu
+1  A: 

The way you list it, with "Fixture 1" for all teams followed by "Fixture 2" for all teams and so on, it's not possible.

Teams play the same number of home and away games, and never play two home games in a row, it follows that teams must alternate home and away through the season.

So, suppose that A and C both play at home on the first week. Then for the rest of the season, they will always either both be playing at home, or both away. When can they play each other? Never.

You need bye weeks, and even then I'm not sure whether it's possible and how many byes you need. Are there any professional leagues which have your home-away alternation rule?

Steve Jessop
Yes, you are right, it is not possible the way I said it. But anyway, the question still stands for the fixtures, even if a team will play two consecutive home games.
morsanu