Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the schedule generator for Football GM - bye weeks #333

Open
dumbmatter opened this issue Dec 2, 2020 · 1 comment
Open

Improve the schedule generator for Football GM - bye weeks #333

dumbmatter opened this issue Dec 2, 2020 · 1 comment

Comments

@dumbmatter
Copy link
Member

Currently, if you have 32 teams spread evenly into 2 conferences each with 4 divisions, FBGM tries to generate an NFL-like schedule. 16 games and 2 against each division opponent (1 home 1 away), and 10 games against other teams (5 home 5 away). The NFL has some other constraints that would be nice to include, but that's not the point of this issue.

The point of this issue is bye weeks. In the NFL, each team has 1 bye week. In FBGM, each team has more than that. Why? Because after all the matchups are defined in FBGM, the order of games is set by sorting them randomly. Then, they are broken into "weeks" by taking all the games from that random list of games up until the same team would play twice, and calling that a "week". This is the code that breaks it into weeks, although they are called "days" there because it was written first for BBGM, but same thing. This results in multiple bye weeks per team, because the random sorting means it'd be very unlikely for all teams to play in a single week.

So, first part of fixing this would be to replace the random sort with something smarter. If it's possible to always sort it so that all games are played in just 16 weeks (so the list of games contains 16 chunks of 16 games between all 32 teams, with no repeats until the next chunk) then that would be a good start.

Then to handle bye weeks, that sorting could be slightly modified to be made up of 17 chunks, with some of those chunks containing fewer than 16 games. I'm not sure if this will require explicitly adding bye weeks to the list of games, or of the current output of newSchedule.football.ts will be good enough (how it splits weeks by the first game where a team already played this week).

Or maybe I'm thinking about this all wrong and there is a better way to do it. I'm sure people have written NFL schedule generators before.

Also there are unit tests of the current schedule generator, which can give you an idea how it works. Ideally you would add some more tests as part of this issue!

@dumbmatter
Copy link
Member Author

Would also be nice to constrain it so that you never play non-division teams more than once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant