I can do a general round robin no problem. This is a bit more complex. A regular round robin does not solve this. 11 teams, 5 courts, 1 bye per week. Round robining the teams is done, then round robining the teams and courts is where this is different.
I have 11 teams, 14 play dates, and 5 available courts. Two teams per court per date, 1 team on a bye.
Trying to make it so each team never has more than 2 byes, never plays the same team more than 2 times, and never plays on the same court more than 3 times.
so arrays of:
$teams = array("Team 1","Team 2","Team 3","Team 4","Team 5","Team 6","Team 7","Team 8","Team 9","Team 10","Team 11");
$courts = array("Court 1","Court 2","Court 3","Court 4","Court 5","Bye");
$dates = array("Date 1","Date 2","Date 3","Date 4","Date 5","Date 6","Date 7","Date 8","Date 9","Date 10","Date 11","Date 12","Date 13","Date 14");
Typical output would be:
[date 1] =>
[court 1] =>
[Team 1]
[Team 2]
[court 2] =>
[Team 3]
[Team 4]
[court 3] =>
[Team 5]
[Team 6]
[court 4] =>
[Team 7]
[Team 8]
[court 5] =>
[Team 9]
[Team 10]
[bye] =>
[Team 11]
[date 2] =>
etc...
I've also tried to simplify it and randomly pick one team per date as the Bye for the week, so the array of teams only has 10 and not 11, but it hasn't helped.
Is there an easy way to do this? Is it even possible?
Edit: It's not that my code isn't working, more that I can't come up with a 100% way of doing it, not even sure if it's possible. Using the scheduler code you linked, I can make a set of round robins with 11 records, each team playing a different team each time plus one bye. Then appending on the first 3 sets to the end for a total of 14 (14 play dates).
That's all perfectly random and works fine. But then trying to assign one of 5 courts per 2 teams, AND trying to get each team playing each of the 5 courts no more than 3 times across those 14 days is where I'm blanking. The fact that there are 2 teams per court each day is where I'm getting stuck. If it was one team, checking they've hit the 3 limit then reassigning wouldn't be very tough. But having 2 teams on each court is the sticking point.