Modern: fixture table per league size, league dates and finished leagues (M2)

- schedule: kLeagueTablesPerLeague lets every league use the table of its own
  size (international leagues of 20 and 18 side by side); Classic leaves it off.
- Modern: a league that has played all its rounds sits out the remaining dates
  of its calendar group.
- modern/game/world_calendar: season days of ISO dates and placing a league
  group's dates in the season calendar around special days, with tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-23 18:24:43 +02:00
1 parent f2fcb28f65
commit a4a37f1cb2
10 files changed
+189 -6

No files matched your search

+7 -3
View File
@@ -124,7 +124,10 @@ std::vector<Fixture> generate_fixtures(int teams, int matchday, int rounds, int
return out;
}
int league_table_teams(int league) { return league < 5 ? kLeagueSizes[0] : kLeagueSizes[5]; }
int league_table_teams(int league) {
if (kLeagueTablesPerLeague) return kLeagueSizes[league];
return league < 5 ? kLeagueSizes[0] : kLeagueSizes[5];
}
void set_league_sizes(const uint8_t (&sizes)[kLeagueCount]) {
int total = 0;
@@ -132,9 +135,10 @@ void set_league_sizes(const uint8_t (&sizes)[kLeagueCount]) {
const auto has_table = [](int teams) { return teams == 20 || teams == 18 || teams == 16 || teams == 12; };
if (total != world_layout().league_teams || !has_table(sizes[0]) || !has_table(sizes[5]))
throw std::invalid_argument("league sizes do not describe 138 league teams with fixture tables");
for (int l = 0; l < kLeagueCount; l++)
if (sizes[l] < 2 || sizes[l] > (l < 5 ? sizes[0] : sizes[5]))
for (int l = 0; l < kLeagueCount; l++) {
if (kLeagueTablesPerLeague ? !has_table(sizes[l]) : sizes[l] < 2 || sizes[l] > (l < 5 ? sizes[0] : sizes[5]))
throw std::invalid_argument("a league is larger than its fixture table");
}
for (int l = 0; l < kLeagueCount; l++) kLeagueSizes[l] = sizes[l];
}
+3
View File
@@ -98,6 +98,9 @@ int team_league(int team);
// LeagueTableTeams). The same as the league size except for the English fifth league (10 teams),
// which belongs to no calendar group and is never played.
int league_table_teams(int league);
// Modern worlds play every league on the table of its own size (international leagues of
// 20 and 18 clubs side by side). Classic leaves this off: leagues 5-8 share the table of league 5.
inline bool kLeagueTablesPerLeague = false;
struct Fixture {
int home; // team id