|
Player12
An open source football management simulator
|
Continental club competitions: rules, draws and tables. More...
Classes | |
| struct | CompetitionRules |
| struct | DrawTeam |
| struct | LeagueFixture |
| struct | Prizes |
Enumerations | |
| enum class | Continent : uint8_t { Europe , Americas } |
| enum class | Round : uint8_t { LeaguePhase = 0 , Playoff , RoundOf16 , QuarterFinal , SemiFinal , Final } |
Functions | |
| const CompetitionRules * | rules (LeagueID competition_id) |
| std::optional< Continent > | continentOf (LeagueID league_id) |
| uint8_t | directPlaces (uint8_t clubs) |
| uint8_t | playoffPlaces (uint8_t clubs) |
| Round | firstKnockoutRound (uint8_t clubs) |
| uint8_t | stageCode (Round round, uint8_t leg) |
| Round | roundOf (uint8_t stage) |
| uint8_t | legOf (uint8_t stage) |
| const char * | roundKey (Round round) |
| std::vector< uint8_t > | allocatePlaces (const CompetitionRules &rules, size_t associations, const std::vector< uint8_t > &capacity) |
| League-phase places per association rank. | |
| std::vector< LeagueFixture > | drawLeaguePhase (const std::vector< DrawTeam > &teams, uint8_t pots, uint32_t seed) |
| Seeded Swiss-model draw. | |
| std::vector< StandingRow > | leaguePhaseTable (const std::vector< TeamID > &entrants, const std::vector< const Match * > &matches, const std::function< double(TeamID)> &coefficient) |
League-phase table: points, goal difference, goals scored, away goals scored, wins, away wins, then coefficient and team ID. | |
Variables | |
| constexpr LeagueID | CHAMPIONS_CUP_ID = 250 |
| constexpr LeagueID | CONTINENTAL_SHIELD_ID = 251 |
| constexpr LeagueID | AMERICAS_CUP_ID = 252 |
| constexpr std::array< CompetitionRules, 3 > | COMPETITIONS |
| constexpr uint8_t | KNOCKOUT_STAGE_BASE = 16 |
Continental club competitions: rules, draws and tables.
Every competition has a league phase (Swiss model: each club meets matches different opponents, one at home and one away from each pot, never a club of its own association and at most two of any other), after which places 1-8 go straight to the round of 16, places 9-24 play a two-legged play-off and the rest are out. Knockout ties have two legs (no away goals; extra time and penalties when the aggregate is level) and the final is a single match at a neutral venue.
Matches are ordinary calendar fixtures with MatchType::CONTINENTAL, the competition ID and a stage code (stageCode()).
|
strong |
|
strong |
| std::vector< uint8_t > Continental::allocatePlaces | ( | const CompetitionRules & | rules, |
| size_t | associations, | ||
| const std::vector< uint8_t > & | capacity | ||
| ) |
League-phase places per association rank.
| associations | Number of associations of the continent. |
capacity per association) run out. | std::optional< Continental::Continent > Continental::continentOf | ( | LeagueID | league_id | ) |
Continent of a league (its region), nullopt when it has none.
| uint8_t Continental::directPlaces | ( | uint8_t | clubs | ) |
League-phase places that go straight to the first knockout round.
| std::vector< Continental::LeagueFixture > Continental::drawLeaguePhase | ( | const std::vector< DrawTeam > & | teams, |
| uint8_t | pots, | ||
| uint32_t | seed | ||
| ) |
Seeded Swiss-model draw.
Teams are split into pots equal pots; every team meets two opponents of each pot (one at home, one away), never one of its association and at most two of any other, and plays once per matchday (2 * pots matchdays). The search is a bounded randomised backtracking; if it cannot satisfy the association limits it relaxes them (first the two-per-association limit, then the own-association ban), so a valid schedule is always returned for pot sizes of at least three.
| Round Continental::firstKnockoutRound | ( | uint8_t | clubs | ) |
Round the direct places enter (round of 16, or quarter-finals).
| std::vector< StandingRow > Continental::leaguePhaseTable | ( | const std::vector< TeamID > & | entrants, |
| const std::vector< const Match * > & | matches, | ||
| const std::function< double(TeamID)> & | coefficient | ||
| ) |
League-phase table: points, goal difference, goals scored, away goals scored, wins, away wins, then coefficient and team ID.
| uint8_t Continental::legOf | ( | uint8_t | stage | ) |
1 or 2 (the final is leg 1).
| uint8_t Continental::playoffPlaces | ( | uint8_t | clubs | ) |
League-phase places that enter the knockout play-off.
| const char * Continental::roundKey | ( | Round | round | ) |
Language key naming a round (e.g. "CONT_ROUND_QUARTER_FINAL").
| Round Continental::roundOf | ( | uint8_t | stage | ) |
| const CompetitionRules * Continental::rules | ( | LeagueID | competition_id | ) |
Rules of a competition ID; nullptr for anything else.
| uint8_t Continental::stageCode | ( | Round | round, |
| uint8_t | leg | ||
| ) |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Every competition of the world, tier order within each continent.
|
inlineconstexpr |
|
inlineconstexpr |
Match::stage of a league-phase matchday is 1-8; knockouts use codes.