You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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!
The text was updated successfully, but these errors were encountered: