1

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.

  • You've definitely got a good start: your definitions for the inputs (Teams, Courts and Dates) look good. Now you need to implement some algorithm to output to a "schedule". This might give you some tips: https://stackoverflow.com/a/10344743/421195 – paulsm4 Jun 02 '22 at 23:02
  • Yea, I've tried using that to round robin the teams in a set of 10 after pulling out one bye team. The issue I'm having is then limiting each team to a max of 3 times per court spread across the 14 dates. – ballinamuck Jun 03 '22 at 19:01
  • I assume you're building your "schedule list" with some PHP "scheduler()" function or PHP class method(s). SUGGESTION: It might be useful if you [Edit] your question, posted the relevant PHP code, and asked about what parts of the code aren't doing what you need. – paulsm4 Jun 03 '22 at 19:30
  • I edited the question with a bit more details, it's a bit more than just the code not working, more of a logical conundrum. I was commenting it out but it was too much text for a single comment. – ballinamuck Jun 03 '22 at 20:34
  • Does this answer your question? [Scheduling algorithm for a round-robin tournament?](https://stackoverflow.com/questions/6648512/scheduling-algorithm-for-a-round-robin-tournament) – Progman Jun 04 '22 at 08:10
  • Thanks, but no. That's another way of round robin just the teams. After I have that then trying to round robin the courts with the teams, all the while keeping individual teams to no more than 3 times on 1 of 5 courts, with 12-13 dates playing (2 byes max, most 1 bye). – ballinamuck Jun 04 '22 at 16:36
  • @ballinamuck When you have 11 teams, where one team plays 10 games to play against every other team once, how/why do you have 14 play dates? And how do you want to schedule the teams to play more than necessary games when the team already have face each other previously? – Progman Jun 05 '22 at 06:27
  • it's just the way this league is setup. 14 dates of play, 11 teams, 5 courts. So two teams could play each other more than once, but maximum 2 times. Some teams would need a second bye week as well. I'm open to suggestions how to determine who plays who the extra 3 dates. I was currently just randomly picking 3 matchup dates and appending them onto the first 11. – ballinamuck Jun 06 '22 at 14:38

0 Answers0