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

National teams: confederations, competitions and pure helpers. More...

Classes

struct  Fixture
 
struct  Group
 
struct  GroupRow
 
struct  Record
 

Enumerations

enum class  Confederation : uint8_t { Europe , Americas , Asia }
 
enum class  Competition : uint8_t {
  Friendly = 0 , WorldQualifier , ContinentalQualifier , NationsLeague ,
  NationsLeagueFinals , WorldFinals , ContinentalFinals
}
 
enum class  Stage : uint8_t { Group = 0 , QuarterFinal , SemiFinal , Final }
 
enum class  CallUpResult : uint8_t {
  Ok = 0 , NoSquad , Locked , TooMany ,
  TooFew , NeedGoalkeepers , Ineligible , Duplicate
}
 Why a squad chosen by a head coach was refused. More...
 

Functions

const char * confederationKey (Confederation confederation)
 
Confederation confederationOf (Language nation)
 
std::string teamNameKey (Language nation)
 
const char * competitionKey (Competition competition)
 
bool isFinals (Competition competition)
 
const char * stageKey (Stage stage)
 
std::optional< Language > winnerOf (const Fixture &fixture)
 
std::vector< GroupRow > groupTable (const Group &group, const std::vector< Fixture > &fixtures, const std::map< Language, double > &rating)
 
bool canSwitchNation (const Record &record, const GameDateValue &today)
 
std::vector< std::vector< std::pair< size_t, size_t > > > roundRobin (size_t teams, bool double_round)
 
size_t finalsSize (size_t pool)
 
const char * callUpResultKey (CallUpResult result)
 
double selectionScore (const Player &player, uint16_t caps, const StatsConfig &config)
 
std::vector< PlayerID > selectSquad (const std::vector< const Player * > &eligible, size_t size, const StatsConfig &config, const std::unordered_map< PlayerID, uint16_t > &caps)
 Picks a squad of size: three goalkeepers and a balanced mix of defenders, midfielders and forwards, ranked by ability, form, condition and experience (caps); shortfalls are filled by the best remaining players. Deterministic (ties by player ID).
 

Variables

constexpr size_t WINDOW_SQUAD = 24
 
constexpr size_t FINALS_SQUAD = 26
 
constexpr size_t MIN_CALL_UPS = 18
 
constexpr size_t MIN_CALL_UP_GOALKEEPERS = 2
 
constexpr int MIN_SQUAD_AGE = 17
 

Detailed Description

National teams: confederations, competitions and pure helpers.

One national team per nationality with enough players. The two-season cycle follows the real calendar: in the season before a summer finals tournament the September-March windows host the qualifiers; in the other season the autumn windows host a nations league (its best group winners meet in June) and March has friendlies. Finals alternate between a world tournament and continental tournaments every two years. Idle nations play friendlies.

Enumeration Type Documentation

◆ CallUpResult

enum class International::CallUpResult : uint8_t
strong

Why a squad chosen by a head coach was refused.

Enumerator
Ok 
NoSquad 

No call-up is due for this nation.

Locked 

The players have already reported.

TooMany 
TooFew 
NeedGoalkeepers 
Ineligible 

Wrong nation, too young, injured or tied elsewhere.

Duplicate 

◆ Competition

enum class International::Competition : uint8_t
strong
Enumerator
Friendly 
WorldQualifier 
ContinentalQualifier 
NationsLeague 
NationsLeagueFinals 
WorldFinals 
ContinentalFinals 

◆ Confederation

enum class International::Confederation : uint8_t
strong
Enumerator
Europe 
Americas 
Asia 

◆ Stage

enum class International::Stage : uint8_t
strong
Enumerator
Group 
QuarterFinal 
SemiFinal 
Final 

Function Documentation

◆ callUpResultKey()

const char * International::callUpResultKey ( CallUpResult  result)

Language key of a call-up verdict.

◆ canSwitchNation()

bool International::canSwitchNation ( const Record &  record,
const GameDateValue &  today 
)

Switching nation (design default, after the 2020 eligibility rules): at most three senior caps, all before 21, none at a finals tournament, and three years since the last one.

◆ competitionKey()

const char * International::competitionKey ( Competition  competition)

Language key naming a competition.

◆ confederationKey()

const char * International::confederationKey ( Confederation  confederation)

Language key naming a confederation.

◆ confederationOf()

Confederation International::confederationOf ( Language  nation)

◆ finalsSize()

size_t International::finalsSize ( size_t  pool)

Finals size for a pool of nations: 16, 8, 4, or 0 (too few).

◆ groupTable()

std::vector< International::GroupRow > International::groupTable ( const Group &  group,
const std::vector< Fixture > &  fixtures,
const std::map< Language, double > &  rating 
)

Group table: points, goal difference, goals scored, then rating.

◆ isFinals()

bool International::isFinals ( Competition  competition)

◆ roundRobin()

std::vector< std::vector< std::pair< size_t, size_t > > > International::roundRobin ( size_t  teams,
bool  double_round 
)

Rounds of a round robin (circle method); pairs are team indices.

◆ selectionScore()

double International::selectionScore ( const Player &  player,
uint16_t  caps,
const StatsConfig &  config 
)

Selection score of a player: ability, form, condition and caps.

◆ selectSquad()

std::vector< PlayerID > International::selectSquad ( const std::vector< const Player * > &  eligible,
size_t  size,
const StatsConfig &  config,
const std::unordered_map< PlayerID, uint16_t > &  caps 
)

Picks a squad of size: three goalkeepers and a balanced mix of defenders, midfielders and forwards, ranked by ability, form, condition and experience (caps); shortfalls are filled by the best remaining players. Deterministic (ties by player ID).

◆ stageKey()

const char * International::stageKey ( Stage  stage)

◆ teamNameKey()

std::string International::teamNameKey ( Language  nation)

Language key of a national team's name (e.g. "NT_Italian").

◆ winnerOf()

std::optional< Language > International::winnerOf ( const Fixture &  fixture)

Winner of a played fixture (penalties included); nullopt for draws.

Variable Documentation

◆ FINALS_SQUAD

constexpr size_t International::FINALS_SQUAD = 26
inlineconstexpr

◆ MIN_CALL_UP_GOALKEEPERS

constexpr size_t International::MIN_CALL_UP_GOALKEEPERS = 2
inlineconstexpr

◆ MIN_CALL_UPS

constexpr size_t International::MIN_CALL_UPS = 18
inlineconstexpr

A head coach calls up at least this many players, two goalkeepers.

◆ MIN_SQUAD_AGE

constexpr int International::MIN_SQUAD_AGE = 17
inlineconstexpr

Youngest age for a senior call-up.

◆ WINDOW_SQUAD

constexpr size_t International::WINDOW_SQUAD = 24
inlineconstexpr

Squad sizes: 24 for a window, 26 for a finals tournament.