Generating Fixtures from a list of n

浪子不回头ぞ 提交于 2019-12-23 21:55:25

问题


Suppose I have N teams and what to generate a fixture list, where every team plays every other team, what is the best practice for this. Is there a known algorithm that does this nicely? Efficiency isn't really a necessity as this only needs to be generated once a season.

To be more specific, I'll start with some definitions: I have N teams... T_1, T_2, ... , T_n. If N is odd, include a 'ghost' team to make the amount of teams even. A set of fixtures for a week is a set of N/2 pairs, with no team in more than one pair. A 'fixture list' is set of sets of fixtures such that every team is paired with every other team.

What I am trying to do is create a 'fixture list' with some kind of random element to it. Thanks


回答1:


Here is the usual way. If you need some random element, you can shuffle the list of teams first. It doesn't matter much, since every team plays every other anyway.



来源:https://stackoverflow.com/questions/4418452/generating-fixtures-from-a-list-of-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!