Player12
An open source football management simulator
Loading...
Searching...
No Matches
match_analysis.h File Reference
#include <array>
#include <cstdint>
#include <functional>
#include <span>
#include <string>
#include <vector>
#include "global/types.h"
#include "model/match_events.h"

Go to the source code of this file.

Classes

struct  ShotRecord
 One shot in the shooter's attacking frame: the shooter attacks towards x = 1 and y = 0 is his left touchline. More...
 
struct  SideSummary
 One side's numbers in the analysed part of the match. More...
 
struct  PlayerNote
 A player worth mentioning. More...
 
struct  AnalysisLine
 A localised line: key plus arguments ({0}, {1}...). More...
 
struct  AnalysisSuggestion
 What the assistant proposes, with the evidence behind it. More...
 
struct  AnalysisInput
 Facts of a live match for the assistant's analysis. More...
 
struct  MatchAnalysis
 The half-time / full-time analysis. More...
 

Namespaces

namespace  MatchAnalysisRules
 

Enumerations

enum class  ShotOutcome : std::uint8_t {
  Goal = 0 , Saved , Blocked , OffTarget ,
  Woodwork
}
 How a shot ended (values are persisted in match analytics). More...
 
enum class  Flank : std::uint8_t { Left = 0 , Centre , Right }
 

Functions

std::vector< ShotRecord > extractShots (std::span< const MatchEvent > events)
 
Flank flankOf (const ShotRecord &shot)
 
MatchAnalysis analyseMatch (const AnalysisInput &input)
 
MatchAnalysis analyseLiveMatch (const MatchEngine &engine, bool managed_home, std::function< std::string(PlayerID)> name_of)
 

Variables

constexpr int MatchAnalysisRules::MIN_SHOTS = 8
 
constexpr int MatchAnalysisRules::CONFIDENT_SHOTS = 16
 
constexpr float MatchAnalysisRules::FLANK_SHARE = 0.55f
 
constexpr float MatchAnalysisRules::FLANK_MIN_XG = 0.35f
 
constexpr int MatchAnalysisRules::FLANK_MIN_SHOTS = 5
 
constexpr int MatchAnalysisRules::PRESS_MIN_PASSES = 60
 
constexpr int MatchAnalysisRules::PRESS_MIN_ACTIONS = 5
 
constexpr int MatchAnalysisRules::CREATE_MIN_PASSES = 100
 
constexpr int MatchAnalysisRules::TIGHTEN_MIN_SHOTS = 6
 
constexpr float MatchAnalysisRules::STANDOUT_RATING = 7.5f
 
constexpr float MatchAnalysisRules::STRUGGLING_RATING = 5.6f
 
constexpr float MatchAnalysisRules::RATING_MIN_MINUTES = 20.0f
 
constexpr float MatchAnalysisRules::TIRED_CONDITION = 0.55f
 
constexpr int MatchAnalysisRules::MIN_AERIALS = 6
 
constexpr float MatchAnalysisRules::AERIAL_LOSS_SHARE = 0.65f
 
constexpr float MatchAnalysisRules::LOOSE_PRESS = 14.0f
 
constexpr int MatchAnalysisRules::MAX_SUGGESTIONS = 3
 

Enumeration Type Documentation

◆ Flank

enum class Flank : std::uint8_t
strong

Flank of the pitch seen from the attacking side (left, centre, right).

Enumerator
Left 
Centre 
Right 

◆ ShotOutcome

enum class ShotOutcome : std::uint8_t
strong

How a shot ended (values are persisted in match analytics).

Enumerator
Goal 
Saved 
Blocked 
OffTarget 
Woodwork 

Function Documentation

◆ analyseLiveMatch()

MatchAnalysis analyseLiveMatch ( const MatchEngine &  engine,
bool  managed_home,
std::function< std::string(PlayerID)>  name_of 
)

Collects the facts from a live engine and analyses them.

◆ analyseMatch()

MatchAnalysis analyseMatch ( const AnalysisInput &  input)

Builds the analysis from the facts (pure, deterministic).

◆ extractShots()

std::vector< ShotRecord > extractShots ( std::span< const MatchEvent >  events)

Shots of the match log with their outcome, in attacking frames. A shot is a goal when a goal by the same player follows before the next shot.

◆ flankOf()

Flank flankOf ( const ShotRecord &  shot)

Flank of a shot in its attacking frame.