I have 13 soccer teams who plays 2 games by week (10 weeks in total). Since I have an odd number of teams, I add a fictive team called "Practice". Also, I would like to generate a schedule in which each team plays against the other teams only once. I know the list of those games are obtained by C(14, 2) = 91 couples of games.
However, my biggest problem is to sort them in a way that satisfy my constraints : Each one plays against each one.
Since I have 10 weeks and each week is 2 games, it gives a total of 20 games for each teams (20 * 14 / 2), thus a big total of 140 games to schedule. Since I have a 91-games block, I just want to repeat it to complete to 140 games.
I tried many code around here and each time I got the same problem that a Team A plays a Team B in week 1 and then plays again each other on Week 3 which is not correct.
I am pretty sure there's a solution to this (backtracking or graph theory), but I didn't find it at the moment.
Thanks to all for your time :)