Pergunta

I have an algorithm that creates a round robin tournament using the Balanced Algorithm , which creates for a pool size of four the following games.

1-2 Round 1
3-4 Round 1
1-3 Round 2
2-4 Round 2
1-4 Round 3
2-3 Round 3

I would like the games to have a balanced amount of home to away games as possible. From the above you can see that 1 is always the first team in the game, meaning the away team, but would like to balance that out in the games and make it sometimes the home team. You can see below I switched the round 2 games so 1 can play a home game, and 4 can play away game. Is there a simple algorithm to accomplish this after the games have been figured out?

1-2 Round 1
3-4 Round 1
3-1 Round 2
4-2 Round 2
1-4 Round 3
2-3 Round 3
Foi útil?

Solução

For this simple case you have (no repeated matches between the same teams that need to be played in different locations), you can calculate, for each pair:

X = (Team_Number_1 + Team_Number_2) % 2

and swap the pairs where X = 0. Assuming the lower number team is initially always the first in the pair (and you describe the list as such) this should result in an optimal distribution of home and away games.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top