Grail (C++)  1.2.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
SimulatedGameHelper.h
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_SIMULATED_GAME_HELPER_H
4 #define GRAIL_SIMULATED_GAME_HELPER_H
5 
6 #include <memory>
7 #include <vector>
8 #include "SimulatedGameRuntime.hh"
9 
10 namespace grail
11 {
12 namespace simgames
13 {
14  class SimulatedGameNode;
15  class SimulatedGameSnapshotObserver;
16 
17  //This class should not be visible to developers at all
19  {
21  void SetTeamCount(int teamCount);
22  void SetExplorationRatio(double explorationRatio);
23  void SetFreezeVisitsTreshold(size_t treshold);
24 
26  void Reset();
27 
29  void ApplyActions() const;
30  void ApplyActionsWithDebug(SimulatedGameSnapshotObserver& observer) const;
31  void Backpropagation();
32 
34  void BackpropagationWithTerminal(std::vector<float>& scores);
35 
36  double explorationConstant{};
37  size_t freezeVisitsTreshold{};
38  std::vector<SimulatedGameNode*> visitedNodes{};
39  std::vector<size_t> actionIndicesHistory{};
40  std::unique_ptr<SimulatedGameRuntime> runtimeControl{};
41 
42  friend class SimulatedGameSnapshotObserver;
43  };
44 }
45 }
46 
47 #endif //GRAIL_SIMULATED_GAME_HELPER_H
grail::simgames::SimulatedGameHelper::ApplyActions
void ApplyActions() const
Applies deferred actions (to be called when the process falls out of the tree and Monte Carlo phase i...
Definition: SimulatedGameHelper.cpp:38
grail::simgames::SimulatedGameHelper
Definition: SimulatedGameHelper.h:18
grail::simgames::SimulatedGameSnapshotObserver
Definition: SimulatedGameSnapshotObserver.h:23
grail::simgames::SimulatedGameHelper::BackpropagationWithTerminal
void BackpropagationWithTerminal(std::vector< float > &scores)
This is backpropagation that checks whether a state is terminal.
Definition: SimulatedGameHelper.cpp:64
grail::simgames::SimulatedGameHelper::Reset
void Reset()
Resets to a state adequate to the start of a new simulation.
Definition: SimulatedGameHelper.cpp:31