(C++)  1.0.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
SimulatedGamesSnapshots.h
1 #ifndef GRAIL_SIMULATED_GAMES_SNAPSHOTS_H
2 #define GRAIL_SIMULATED_GAMES_SNAPSHOTS_H
3 
4 #include <string>
5 #include <unordered_map>
6 #include <map>
7 #include <vector>
8 
9 namespace grail
10 {
11  namespace simulation
12  {
13  class ISimulatedGameUnit;
14 
18  {
20  int teamIndex = 0;
21 
23  int orderID = 0;
24 
26  std::string description = "";
27 
29  std::map<std::string, std::string> state = {};
30 
31  SimulatedGameUnitSnapshot(int teamIndex, int orderID, const std::string& unitDescription);
32  SimulatedGameUnitSnapshot() = default;
33  };
34 
38  {
40  double score = 0;
41 
43  int visits = 0;
44 
46  std::string actionDescription = "";
47 
48  SimulatedGameActionMetadataSnapshot(double score, int visits, const std::string& description);
50  };
51 
55  {
57  std::string chosenActionDescription = {};
58 
60  std::vector<SimulatedGameUnitSnapshot> unitSnapshots = {};
61  int activeUnitUID = 0;
62  };
63 
67  {
68  std::vector<SimulatedGameActionMetadataSnapshot> actionMetadataSnapshots = {};
70  };
71 
75  {
76  size_t number = 0;
77 
79  std::vector<SimulatedGameUCTEventSnapshot> uctSnapshots = {};
80 
82  std::vector<SimulatedGameMonteCarloEventSnapshot> monteCarloSnapshots = {};
83 
85  std::vector<float> scores = {};
86 
88  void Clear();
89  };
90  }
91 
95  {
97  std::vector<simulation::SimulatedGameUnitSnapshot> unitSnapshots = {};
98 
100  std::vector<simulation::SimulatedGameIterationSnapshot> iterationSnapshots = {};
101 
102  float absoluteTime = 0;
103  float relativeTime = 0;
104  size_t entityId = 0;
105  };
106 }
107 #endif //GRAIL_SIMULATED_GAMES_SNAPSHOTS_H
Definition: SimulatedGamesSnapshots.h:95
std::vector< simulation::SimulatedGameUnitSnapshot > unitSnapshots
Units that took part in the game.
Definition: SimulatedGamesSnapshots.h:97
std::vector< simulation::SimulatedGameIterationSnapshot > iterationSnapshots
Snapshots of iterations contained in the SimulatedGameSnapshot.
Definition: SimulatedGamesSnapshots.h:100
Definition: SimulatedGamesSnapshots.h:38
double score
Quality of the action.
Definition: SimulatedGamesSnapshots.h:40
int visits
The number of visits of the action = how many times it was sampled in iterations.
Definition: SimulatedGamesSnapshots.h:43
std::string actionDescription
Text representation of the action.
Definition: SimulatedGamesSnapshots.h:46
Definition: SimulatedGamesSnapshots.h:75
std::vector< float > scores
Scores achieved by teams at the end of the iteration.
Definition: SimulatedGamesSnapshots.h:85
void Clear()
Clears all the stored data.
Definition: SimulatedGamesSnapshots.cpp:16
std::vector< SimulatedGameMonteCarloEventSnapshot > monteCarloSnapshots
Events that happened during the iteration in the Monte Carlo (simulation) phase.
Definition: SimulatedGamesSnapshots.h:82
std::vector< SimulatedGameUCTEventSnapshot > uctSnapshots
Events that happened during the iteration in the UCT (selection) phase.
Definition: SimulatedGamesSnapshots.h:79
Definition: SimulatedGamesSnapshots.h:55
std::vector< SimulatedGameUnitSnapshot > unitSnapshots
States of units after action was performed.
Definition: SimulatedGamesSnapshots.h:60
std::string chosenActionDescription
The action performed by the active unit.
Definition: SimulatedGamesSnapshots.h:57
Definition: SimulatedGamesSnapshots.h:67
Definition: SimulatedGamesSnapshots.h:18
int orderID
Ordered unique identifier of the unit. In this order they will apear in the GUI tool.
Definition: SimulatedGamesSnapshots.h:23
std::string description
Display text for the unit in logs and GUI tool.
Definition: SimulatedGamesSnapshots.h:26
int teamIndex
The "owning" player. Units of the same team should share the same color in the GUI tool.
Definition: SimulatedGamesSnapshots.h:20
std::map< std::string, std::string > state
State of the unit as serialized by FillDebugRepresentation method of a unit.
Definition: SimulatedGamesSnapshots.h:29