Player12
An open source football management simulator
Loading...
Searching...
No Matches
Continental Namespace Reference

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
 

Detailed Description

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()).

Enumeration Type Documentation

◆ Continent

enum class Continental::Continent : uint8_t
strong
Enumerator
Europe 
Americas 

◆ Round

enum class Continental::Round : uint8_t
strong
Enumerator
LeaguePhase 
Playoff 
RoundOf16 
QuarterFinal 
SemiFinal 
Final 

Function Documentation

◆ allocatePlaces()

std::vector< uint8_t > Continental::allocatePlaces ( const CompetitionRules &  rules,
size_t  associations,
const std::vector< uint8_t > &  capacity 
)

League-phase places per association rank.

Parameters
associationsNumber of associations of the continent.
Returns
Places for rank 1..n; they add up to rules.clubs unless the clubs available (capacity per association) run out.

◆ continentOf()

std::optional< Continental::Continent > Continental::continentOf ( LeagueID  league_id)

Continent of a league (its region), nullopt when it has none.

◆ directPlaces()

uint8_t Continental::directPlaces ( uint8_t  clubs)

League-phase places that go straight to the first knockout round.

◆ drawLeaguePhase()

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.

◆ firstKnockoutRound()

Round Continental::firstKnockoutRound ( uint8_t  clubs)

Round the direct places enter (round of 16, or quarter-finals).

◆ leaguePhaseTable()

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.

◆ legOf()

uint8_t Continental::legOf ( uint8_t  stage)

1 or 2 (the final is leg 1).

◆ playoffPlaces()

uint8_t Continental::playoffPlaces ( uint8_t  clubs)

League-phase places that enter the knockout play-off.

◆ roundKey()

const char * Continental::roundKey ( Round  round)

Language key naming a round (e.g. "CONT_ROUND_QUARTER_FINAL").

◆ roundOf()

Round Continental::roundOf ( uint8_t  stage)

◆ rules()

const CompetitionRules * Continental::rules ( LeagueID  competition_id)

Rules of a competition ID; nullptr for anything else.

◆ stageCode()

uint8_t Continental::stageCode ( Round  round,
uint8_t  leg 
)

Variable Documentation

◆ AMERICAS_CUP_ID

constexpr LeagueID Continental::AMERICAS_CUP_ID = 252
inlineconstexpr

◆ CHAMPIONS_CUP_ID

constexpr LeagueID Continental::CHAMPIONS_CUP_ID = 250
inlineconstexpr

◆ COMPETITIONS

constexpr std::array<CompetitionRules, 3> Continental::COMPETITIONS
inlineconstexpr

Every competition of the world, tier order within each continent.

◆ CONTINENTAL_SHIELD_ID

constexpr LeagueID Continental::CONTINENTAL_SHIELD_ID = 251
inlineconstexpr

◆ KNOCKOUT_STAGE_BASE

constexpr uint8_t Continental::KNOCKOUT_STAGE_BASE = 16
inlineconstexpr

Match::stage of a league-phase matchday is 1-8; knockouts use codes.