Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating Fixtures from a list of n

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

like image 835
Austin Platt Avatar asked Nov 21 '25 21:11

Austin Platt


1 Answers

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.

like image 59
sdcvvc Avatar answered Nov 24 '25 15:11

sdcvvc