2

Balanced Algorithm を使用してラウンド ロビン トーナメントを作成するアルゴリズムがあります。これにより、次のゲームのプール サイズが 4 になります。

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

できるだけホーム対アウェイのバランスのとれた試合をしたいと思っています。上記から、1 は常にゲームの最初のチーム、つまりアウェイ チームであることがわかりますが、ゲームでバランスを取り、ホーム チームにすることもあります。以下に示すように、ラウンド 2 のゲームを切り替えて、1 人がホーム ゲームをプレイし、4 人がアウェイ ゲームをプレイできるようにしました。ゲームが理解された後にこれを達成するための簡単なアルゴリズムはありますか?

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

1 に答える 1

3

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.

于 2012-05-14T07:34:23.057 に答える