|
Player12
An open source football management simulator
|
Domestic competitions: league pyramids, cups, knockout resolution and promotion/relegation. More...
Classes | |
| struct | CupDraw |
| A cup round that has been drawn, as the calendar holds it. More... | |
| struct | CupRound |
| struct | CupStatus |
| struct | KnockoutResolution |
| struct | LeagueMovement |
| struct | ShootoutResult |
Functions | |
| uint32_t | mixSeed (uint32_t a, uint32_t b, uint32_t c) |
| LeagueID | rootLeague (const GameData &gamedata, LeagueID league_id) |
| uint8_t | leagueTier (const GameData &gamedata, LeagueID league_id) |
| std::vector< LeagueID > | countryRoots (const GameData &gamedata) |
| std::vector< LeagueID > | countryLeagues (const GameData &gamedata, LeagueID root) |
| std::vector< TeamID > | cupEntrants (const GameData &gamedata, LeagueID root) |
| std::string | cupName (const GameData &gamedata, LeagueID root) |
| std::string | leagueName (const League &league) |
| std::string | leagueNameArg (const League &league) |
| uint8_t | cupRoundCount (size_t entrants) |
| const char * | cupRoundLabelKey (uint8_t stage, uint8_t total_rounds) |
| CupStatus | cupStatus (const Calendar &calendar, const GameData &gamedata, LeagueID root) |
| void | scheduleCupFirstRounds (Calendar &calendar, const GameData &gamedata, uint16_t season_year) |
| Schedules round 1 of every domestic cup. | |
| size_t | drawPendingCupRounds (Calendar &calendar, const GameData &gamedata, uint16_t season_year, const GameDateValue &today) |
| Draws the next round of every cup whose latest round is complete. | |
| std::optional< CupDraw > | cupDraw (const Calendar &calendar, const GameData &gamedata, LeagueID root, uint8_t stage) |
Read-only view of a drawn round of the cup of root (nullopt when that round has not been drawn). Never changes the calendar. | |
| float | penaltyConversionProbability (float shooting, float goalkeeping) |
| ShootoutResult | simulateShootout (const std::vector< float > &home_takers, const std::vector< float > &away_takers, std::mt19937 &rng) |
| Best-of-five shootout with early finish, then sudden death. | |
| KnockoutResolution | resolveDrawnKnockout (const Team &home, const Team &away, const StatsConfig &stats_config, uint32_t seed) |
| std::vector< LeagueMovement > | computeLeagueMovements (const GameData &gamedata, const std::unordered_map< LeagueID, std::vector< StandingRow > > &standings) |
| Swaps the bottom clubs of each parent league with the top clubs of its child division(s), using final standings. | |
| void | applyLeagueMovements (GameData &gamedata, const std::vector< LeagueMovement > &movements) |
Variables | |
| constexpr size_t | PROMOTION_SLOTS = 3 |
Domestic competitions: league pyramids, cups, knockout resolution and promotion/relegation.
A "country" is a pyramid rooted at a league without a parent league; every league whose parent chain reaches the root belongs to it. Each country has one domestic cup whose ID is the root league ID (with MatchType::CUP).
| void Competitions::applyLeagueMovements | ( | GameData & | gamedata, |
| const std::vector< LeagueMovement > & | movements | ||
| ) |
Moves the teams between leagues (team league IDs and league rosters).
| std::vector< Competitions::LeagueMovement > Competitions::computeLeagueMovements | ( | const GameData & | gamedata, |
| const std::unordered_map< LeagueID, std::vector< StandingRow > > & | standings | ||
| ) |
Swaps the bottom clubs of each parent league with the top clubs of its child division(s), using final standings.
All leagues of a country ordered by tier then ID.
Root league IDs (one per country), ascending.
| std::optional< Competitions::CupDraw > Competitions::cupDraw | ( | const Calendar & | calendar, |
| const GameData & | gamedata, | ||
| LeagueID | root, | ||
| uint8_t | stage | ||
| ) |
Read-only view of a drawn round of the cup of root (nullopt when that round has not been drawn). Never changes the calendar.
Every club of the country's pyramid.
Cup name in the current language: the CUP_NAME_<LEAGUE NAME> key of the root league (e.g. CUP_NAME_ITALIAN_LEAGUE) when the language has one, otherwise built from the data pack's league name ("X League" -> "X Cup").
| uint8_t Competitions::cupRoundCount | ( | size_t | entrants | ) |
Knockout rounds needed so that exactly one team remains.
| const char * Competitions::cupRoundLabelKey | ( | uint8_t | stage, |
| uint8_t | total_rounds | ||
| ) |
Language key naming a cup round (final, semi-final, ...).
| Competitions::CupStatus Competitions::cupStatus | ( | const Calendar & | calendar, |
| const GameData & | gamedata, | ||
| LeagueID | root | ||
| ) |
| size_t Competitions::drawPendingCupRounds | ( | Calendar & | calendar, |
| const GameData & | gamedata, | ||
| uint16_t | season_year, | ||
| const GameDateValue & | today | ||
| ) |
Draws the next round of every cup whose latest round is complete.
| std::string Competitions::leagueName | ( | const League & | league | ) |
League name in the current language: the LEAGUE_NAME_<LEAGUE NAME> key (e.g. LEAGUE_NAME_ITALIAN_LEAGUE) when the language has one, otherwise the data pack's name, so custom packs keep their own names.
| std::string Competitions::leagueNameArg | ( | const League & | league | ) |
Inbox argument naming league ("@LEAGUE_NAME_..." when translated).
1 for a top division, 2 for the division below, ...
| uint32_t Competitions::mixSeed | ( | uint32_t | a, |
| uint32_t | b, | ||
| uint32_t | c | ||
| ) |
Deterministic seed mixing (e.g. season year, competition, round).
| float Competitions::penaltyConversionProbability | ( | float | shooting, |
| float | goalkeeping | ||
| ) |
Conversion chance of one kick (~75% for average taker and keeper).
| Competitions::KnockoutResolution Competitions::resolveDrawnKnockout | ( | const Team & | home, |
| const Team & | away, | ||
| const StatsConfig & | stats_config, | ||
| uint32_t | seed | ||
| ) |
Extra time (30 minutes) and, if still level, penalties.
Top league of the pyramid containing league_id.
| void Competitions::scheduleCupFirstRounds | ( | Calendar & | calendar, |
| const GameData & | gamedata, | ||
| uint16_t | season_year | ||
| ) |
Schedules round 1 of every domestic cup.
When the entrant count is not a power of two only the lowest-tier clubs play a preliminary round; everybody else receives a bye to round 2. Midweek rounds are spread from Tuesday to Thursday: each tie takes the day that best rests both clubs, then the quietest.
| Competitions::ShootoutResult Competitions::simulateShootout | ( | const std::vector< float > & | home_takers, |
| const std::vector< float > & | away_takers, | ||
| std::mt19937 & | rng | ||
| ) |
Best-of-five shootout with early finish, then sudden death.
| home_takers | Conversion probabilities of the home kickers in order. |
| away_takers | Conversion probabilities of the away kickers in order. |
|
constexpr |
Teams promoted/relegated between two linked divisions of 20 teams.