|
Player12
An open source football management simulator
|
Run-in maths of a league table: which outcomes are mathematically decided (title, promotion, play-off and continental places, survival) and what a club still needs from its own games. More...
Classes | |
| struct | ClinchReport |
| struct | RaceFixture |
| struct | RaceInput |
| struct | RaceNeed |
| struct | RacePlaces |
| Table places that decide something. Promotion, play-off and continental places count from the top (play-off places follow the promotion places; continental includes continental_top), relegation from the bottom. 0 means the league has none. More... | |
Enumerations | |
| enum class | Race : uint8_t { TITLE , PROMOTION , PLAY_OFF , CONTINENTAL_TOP , CONTINENTAL , SURVIVAL } |
| enum class | RaceState : uint8_t { NONE , OPEN , SECURED , LOST } |
| enum class | Clinch : uint8_t { OPEN , CHAMPION , PROMOTED , PLAY_OFF , CONTINENTAL_TOP , CONTINENTAL , SAFE , RELEGATED } |
Functions | |
| std::vector< StandingRow > | compute (const League &league, const Calendar &calendar, const GameData &gamedata) |
| Computes a league table from the played league fixtures. | |
| uint16_t | raceCutoff (Race race, const RacePlaces &places, size_t clubs) |
| ClinchReport | clinchReport (const RaceInput &input, const RacePlaces &places, TeamID team) |
| Clinch | clinchStatus (const RaceInput &input, const RacePlaces &places, TeamID team) |
| std::vector< ClinchReport > | clinchReports (const RaceInput &input, const RacePlaces &places) |
| std::vector< RaceNeed > | whatYouNeed (const RaceInput &input, const RacePlaces &places, TeamID team) |
What team needs in its still open races, most ambitious first. | |
| RaceInput | raceInput (const League &league, const Calendar &calendar, const GameData &gamedata) |
| RacePlaces | racePlaces (const GameData &gamedata, const ContinentalCompetitions *continental, LeagueID league_id) |
| Deciding places of a league: promotion and relegation as the season-end movements apply them; continental places (top divisions only) from the current association ranking, minus the place the domestic cup winner can take. | |
Variables | |
| constexpr uint16_t | POINTS_FOR_WIN = 3 |
| constexpr uint16_t | POINTS_FOR_DRAW = 1 |
| constexpr size_t | FORM_LENGTH = 5 |
| constexpr size_t | RACE_COUNT = 6 |
| constexpr uint16_t | MAX_NEED_GAMES = 6 |
Run-in maths of a league table: which outcomes are mathematically decided (title, promotion, play-off and continental places, survival) and what a club still needs from its own games.
Everything is derived from the fixtures themselves: the played results give the current table and the head-to-head records, the unplayed ones the games still to come. A result is only reported as decided when it holds for every combination of the remaining results and every possible score, under the league's tie-break rule (see Standings::compute).
|
strong |
|
strong |
|
strong |
| Standings::ClinchReport Standings::clinchReport | ( | const RaceInput & | input, |
| const RacePlaces & | places, | ||
| TeamID | team | ||
| ) |
Decided races and headline status of one club.
| std::vector< Standings::ClinchReport > Standings::clinchReports | ( | const RaceInput & | input, |
| const RacePlaces & | places | ||
| ) |
clinchReport for every club, in input.teams order.
| Standings::Clinch Standings::clinchStatus | ( | const RaceInput & | input, |
| const RacePlaces & | places, | ||
| TeamID | team | ||
| ) |
Headline status of one club (see clinchReport).
| std::vector< StandingRow > Standings::compute | ( | const League & | league, |
| const Calendar & | calendar, | ||
| const GameData & | gamedata | ||
| ) |
Computes a league table from the played league fixtures.
The calendar is the single source of truth. With the league's TieBreakRule::GOAL_DIFFERENCE teams are ordered by points, goal difference, goals scored, then a head-to-head mini-league (points, goal difference) among the tied teams; with TieBreakRule::HEAD_TO_HEAD the mini-league comes right after points, followed by overall goal difference and goals scored. Remaining ties fall back to team name, then team ID.
| uint16_t Standings::raceCutoff | ( | Race | race, |
| const RacePlaces & | places, | ||
| size_t | clubs | ||
| ) |
Number of places (from the top) that decide a race; 0 = no such race.
| Standings::RaceInput Standings::raceInput | ( | const League & | league, |
| const Calendar & | calendar, | ||
| const GameData & | gamedata | ||
| ) |
Fixtures, clubs and tie-break rule of a league from the calendar.
| Standings::RacePlaces Standings::racePlaces | ( | const GameData & | gamedata, |
| const ContinentalCompetitions * | continental, | ||
| LeagueID | league_id | ||
| ) |
Deciding places of a league: promotion and relegation as the season-end movements apply them; continental places (top divisions only) from the current association ranking, minus the place the domestic cup winner can take.
| std::vector< Standings::RaceNeed > Standings::whatYouNeed | ( | const RaceInput & | input, |
| const RacePlaces & | places, | ||
| TeamID | team | ||
| ) |
What team needs in its still open races, most ambitious first.
Worked out only in the run-in (at most MAX_NEED_GAMES league games left for the club); earlier, or when the search would be too long, the list is empty. Races already decided are left out.
|
constexpr |
|
inlineconstexpr |
|
constexpr |
|
constexpr |
|
inlineconstexpr |