View Single Post
Old 07-21-2017, 10:59 PM   #123
Fishbreath
Minors (Double A)
 
Fishbreath's Avatar
 
Join Date: Oct 2015
Posts: 145
Well, that was a productive few nights. New version available in the first post. Big news first:

Code:
Length of schedule: at most 201 days
Scheduled 810 series (2430 games) in 0.304 seconds
2664.4736842105262 series/sec
Also big news: the scheduling engine now no longer needs padding, and can notify you ahead of time if it can't make a schedule. For schedules with opponent pools of even size, it needs zero padding. For schedules with opponent pools of odd size, it inserts byes automatically for both odd-numbered and even-numbered pools to keep the number of games played roughly in sync over the course of the season. This means that breaks are spread out much more neatly throughout the calendar, with fewer long stretches of no games and more reliable rest days.

It still isn't perfect, in that it can't do perfectly packed schedules. One of the simplifications I accepted in this version to make the setup easier and more flexible was to define a type of game for each day of a season, so on a day when one team is playing a divisional game, all teams are playing divisional games (or on a bye). This does mean that e.g. a 162-game schedule with six divisions of five teams each in two subleagues can't be much shorter than the 201 days above. (You can trim a bit of time with a shorter all-star break.) For perfectly-packed schedules, you'll have to either build them manually, or accept league structures which don't require byes, or only require byes in fewer places. (For instance, a 5/5/5/5 league: there will be byes in divisional play, but can be set up to have two 10-team subleague pools and two 10-team interleague pools, which don't require byes.)

Finally, I spent a few minutes adding a way to turn off the all-star game and break, if that's something you want to skip.

Enjoy! Let me know if you find bugs, particularly with odd league setups. I've done my best to test on a variety of different and unusual structures, but of course I'm not as creative as some here.

Last edited by Fishbreath; 07-21-2017 at 11:41 PM.
Fishbreath is offline   Reply With Quote