|
Player12
An open source football management simulator
|
Namespaces | |
| namespace | ExitCode |
Classes | |
| struct | Band |
| struct | Estimate |
| struct | LabReport |
| struct | MatchJob |
| struct | MatchSample |
| struct | ReportRow |
| struct | SeasonOptions |
| struct | SeasonVitals |
| class | SimulationError |
| struct | Summary |
| struct | TacticPreset |
| struct | TargetSpec |
| struct | TeamSetup |
| struct | TextTable |
| struct | TierVitals |
Enumerations | |
| enum class | Tier : std::uint8_t { Gate , Monitor , Info } |
| enum class | Scope : std::uint8_t { Match , Engine , World , Tactics } |
| enum class | Unit : std::uint8_t { Number , Percent } |
| enum | GameStateIndex : std::uint8_t { LEAD_BY_ONE = 0 , LEVEL = 1 , TRAIL_BY_ONE = 2 } |
| enum | StrengthIndex : std::uint8_t { MAN_DOWN = 0 , EVEN = 1 , MAN_UP = 2 } |
| enum class | Verdict : std::uint8_t { Pass , Warn , Fail , Info , NotMeasured } |
Functions | |
| StatsConfig | loadStatsConfig () |
| Lineup | buildLabLineup (TeamID team_id, float rating, std::vector< std::unique_ptr< Player > > &pool) |
| float | lineupRating (const Lineup &lineup, const StatsConfig &config) |
| std::span< const TargetSpec > | targetTable () |
| std::vector< ReportRow > | evaluateTargets (const std::map< std::string, Estimate > &metrics, std::span< const Scope > scopes) |
| std::string_view | verdictName (Verdict verdict) |
| std::string_view | tierName (Tier tier) |
| std::string | formatValue (double value, Unit unit) |
| nlohmann::json | toJson (const LabReport &report) |
| LabReport | reportFromJson (const nlohmann::json &json) |
| std::string | toMarkdown (const LabReport &report) |
| std::uint32_t | matchSeed (std::uint64_t seed, std::uint64_t index) |
| MatchSample | simulateMatch (const MatchJob &job, const StatsConfig &config) |
| std::vector< MatchSample > | simulateMatches (std::span< const MatchJob > jobs, const StatsConfig &config, unsigned threads, const std::function< void(std::size_t)> &progress) |
| MatchSample | sampleFromReport (const MatchReport &report) |
| std::map< std::string, Estimate > | matchMetrics (std::span< const MatchSample > samples) |
| std::vector< TextTable > | matchTables (std::span< const MatchSample > samples) |
| TextTable | ratingGapTable (std::span< const MatchSample > samples) |
| std::vector< MatchJob > | tacticJobs (std::uint64_t seed, int seeds_per_pair, float rating) |
| std::array< std::size_t, 2 > | tacticPresetsOf (std::size_t job_index, int seeds_per_pair) |
| void | tacticMetrics (std::span< const MatchSample > samples, int seeds_per_pair, std::map< std::string, Estimate > &metrics, std::vector< TextTable > &tables) |
| LabReport | runSeasons (const SeasonOptions &options) |
| double | tQuantile975 (std::size_t degrees_of_freedom) |
| Estimate | meanEstimate (std::span< const double > values) |
| Estimate | proportionEstimate (std::size_t successes, std::size_t trials) |
| Estimate | ratioEstimate (std::span< const double > numerators, std::span< const double > denominators) |
| Estimate | medianEstimate (std::span< const double > values) |
| Estimate | bootstrapEstimate (std::size_t units, const std::function< double(std::span< const std::size_t >)> &statistic, std::uint64_t seed, int resamples) |
| Verdict | classify (const Estimate &estimate, const std::optional< Band > &band) |
Variables | |
| constexpr std::array< TacticPreset, 4 > | TACTIC_PRESETS |
| constexpr double | MONITOR_PASS_THRESHOLD = 0.9 |
| constexpr std::size_t | GOAL_TIME_BINS = 6 |
Synthetic squads and tactic presets for isolated lab matches.
Calibration targets, verdicts and report output (Markdown + JSON) of the balance lab. Report text is an English developer artifact, never shown in the game UI.
Batch simulation of the balance lab: isolated matches and tactics.
Whole-world season runs of the balance lab.
Statistics of the balance lab (fm_lab). Every estimate carries a 95% confidence interval so a realism verdict can tell "off target" apart from "not enough samples".
| enum Lab::GameStateIndex : std::uint8_t |
|
strong |
| enum Lab::StrengthIndex : std::uint8_t |
|
strong |
|
strong |
|
strong |
| Estimate Lab::bootstrapEstimate | ( | std::size_t | units, |
| const std::function< double(std::span< const std::size_t >)> & | statistic, | ||
| std::uint64_t | seed, | ||
| int | resamples = 400 |
||
| ) |
Percentile bootstrap for statistics without a closed-form interval (e.g. variance/mean, rate multipliers). Resamples unit indices with a fixed-seed generator, so the interval is deterministic. statistic receives the indices of one resample (the identity resample for the point estimate) and returns NaN when undefined; such resamples are skipped.
| Lineup Lab::buildLabLineup | ( | TeamID | team_id, |
| float | rating, | ||
| std::vector< std::unique_ptr< Player > > & | pool | ||
| ) |
4-4-2 matchday squad (eleven starters, seven reserves) whose attributes are role-shaped offsets around rating with a small deterministic per-player spread. Same construction as test/test_match_calibration.cpp (createCalibrationTeam), duplicated so the lab does not depend on tests, except that the spread depends on the squad slot only: two squads of the same rating are identical (the test's ID-based spread makes team 1 about 2.3 attribute points stronger than team 2). Players are owned by pool and get IDs team_id * 100 + index.
PASS when the point estimate lies in the band, WARN when it does not but the interval overlaps the band, FAIL when the whole interval is outside. No band gives Info, an invalid estimate NotMeasured.
| std::vector< ReportRow > Lab::evaluateTargets | ( | const std::map< std::string, Estimate > & | metrics, |
| std::span< const Scope > | scopes | ||
| ) |
Evaluates every target of scope_filter against the measured metrics. Targets whose metric is missing are kept as NOT MEASURED rows with a note, so the report always lists the full spec table.
| std::string Lab::formatValue | ( | double | value, |
| Unit | unit | ||
| ) |
"12.3%" or "2.83" (digits chosen from the magnitude).
| float Lab::lineupRating | ( | const Lineup & | lineup, |
| const StatsConfig & | config | ||
| ) |
Mean overall of the eleven starters (the contract's team rating).
| StatsConfig Lab::loadStatsConfig | ( | ) |
The game's stats configuration (assets/config/stats_config.json), so lab players rate exactly like generated ones; the calibration-test constants when the file cannot be read.
| std::map< std::string, Estimate > Lab::matchMetrics | ( | std::span< const MatchSample > | samples | ) |
Every match metric computable from the samples (abandoned matches are excluded and counted in abandoned_share). Keys are TargetSpec::metric names; definitions sit next to each metric in lab_runner.cpp.
| std::uint32_t Lab::matchSeed | ( | std::uint64_t | seed, |
| std::uint64_t | index | ||
| ) |
Deterministic 32-bit match seed number index of a run seeded seed.
| std::vector< TextTable > Lab::matchTables | ( | std::span< const MatchSample > | samples | ) |
Total-goals histogram, top scorelines and goal timing.
| Estimate Lab::meanEstimate | ( | std::span< const double > | values | ) |
Mean of per-unit values; t interval mean +- t * sd / sqrt(n), lower bound clamped at 0 when every value is non-negative.
| Estimate Lab::medianEstimate | ( | std::span< const double > | values | ) |
Median with a distribution-free (binomial order-statistic) interval.
| Estimate Lab::proportionEstimate | ( | std::size_t | successes, |
| std::size_t | trials | ||
| ) |
Share of successes; Wilson score interval (z = 1.96).
| TextTable Lab::ratingGapTable | ( | std::span< const MatchSample > | samples | ) |
Stronger-side results by rating-gap band (NFR-019).
| Estimate Lab::ratioEstimate | ( | std::span< const double > | numerators, |
| std::span< const double > | denominators | ||
| ) |
Ratio of sums sum(num) / sum(den) over sampling units (e.g. goals per shot with matches as units). Delta-method interval: var(R) = sum((num_i - R den_i)^2) / (n (n - 1) mean(den)^2). Units with den = 0 still count (their numerator must then be 0). The lower bound is clamped at 0 when all inputs are non-negative.
| LabReport Lab::reportFromJson | ( | const nlohmann::json & | json | ) |
Inverse of toJson(); throws nlohmann::json::exception on bad input.
| LabReport Lab::runSeasons | ( | const SeasonOptions & | options | ) |
Creates a new AI-only career (no managed club) in the current runtime root, which the caller must point at a scratch directory (FM_RUNTIME_ROOT), and simulates seasons full seasons through GameController::advanceDay(). Throws std::invalid_argument for a bad league filter or season count and std::runtime_error when a season does not complete.
| MatchSample Lab::sampleFromReport | ( | const MatchReport & | report | ) |
Summary of a structured world match report (not detailed).
| MatchSample Lab::simulateMatch | ( | const MatchJob & | job, |
| const StatsConfig & | config | ||
| ) |
Simulates one isolated match on the calling thread with fresh squads (no state is shared between jobs). Throws SimulationError.
| std::vector< MatchSample > Lab::simulateMatches | ( | std::span< const MatchJob > | jobs, |
| const StatsConfig & | config, | ||
| unsigned | threads, | ||
| const std::function< void(std::size_t)> & | progress = nullptr |
||
| ) |
Simulates every job on threads threads (caller included) through the shared ThreadPool; sample i belongs to job i, so the output does not depend on the thread count. progress (optional) is called from the calling thread with the number of finished jobs.
| std::vector< MatchJob > Lab::tacticJobs | ( | std::uint64_t | seed, |
| int | seeds_per_pair, | ||
| float | rating | ||
| ) |
Round robin of TACTIC_PRESETS between equal teams: for each pair and each of seeds_per_pair seeds, both home/away orders with the same seed.
| void Lab::tacticMetrics | ( | std::span< const MatchSample > | samples, |
| int | seeds_per_pair, | ||
| std::map< std::string, Estimate > & | metrics, | ||
| std::vector< TextTable > & | tables | ||
| ) |
SC-004 metric plus the per-preset results table.
| std::array< std::size_t, 2 > Lab::tacticPresetsOf | ( | std::size_t | job_index, |
| int | seeds_per_pair | ||
| ) |
Preset of each side of tacticJobs() job i.
| std::span< const TargetSpec > Lab::targetTable | ( | ) |
Every CT-M/CT-W row of the spec plus the lab's INFO metrics.
| std::string_view Lab::tierName | ( | Tier | tier | ) |
| nlohmann::json Lab::toJson | ( | const LabReport & | report | ) |
| std::string Lab::toMarkdown | ( | const LabReport & | report | ) |
| double Lab::tQuantile975 | ( | std::size_t | degrees_of_freedom | ) |
Two-sided 97.5% quantile of Student's t (1.96 for large samples).
| std::string_view Lab::verdictName | ( | Verdict | verdict | ) |
|
inlineconstexpr |
Goal timing bins: 0-15, 16-30, 31-45+, 46-60, 61-75, 76-90+.
|
inlineconstexpr |
Minimum Monitor pass rate (NFR-018).
|
inlineconstexpr |
The four presets of the tactics screen (gui/scenes/strategy_scene.cpp, PRESETS). Duplicated because the GUI table lives in an anonymous namespace of fm_ui; keep both in sync.