Grail (C++)  1.2.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
SimulatedGameRuntime.hh
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_SIMULATED_GAME_RUNTIME_H
4 #define GRAIL_SIMULATED_GAME_RUNTIME_H
5 
6 #include <vector>
7 
8 namespace grail
9 {
10 namespace simgames
11 {
18  {
19  public:
20  SimulatedGameRuntime(int teamCount);
21 
23  float GetScore(int player) const;
24 
26  void SetScore(int player, float score);
27 
29  bool IsTerminationRequest() const;
30 
32  void SetTerminationRequest();
33 
34  private:
35  void reset();
36 
37  std::vector<float> scores{};
38  int currentStep = 0;
39  bool terminationRequest = false;
40 
41  friend struct SimulatedGameHelper;
42  friend class SimulatedGame;
43  friend class SimulatedGameNode;
44  };
45 }
46 }
47 #endif //GRAIL_SIMULATED_GAME_RUNTIME_H
grail::simgames::SimulatedGameRuntime::GetScore
float GetScore(int player) const
Gets the score value set for a given player.
Definition: SimulatedGameRuntime.cpp:10
grail::simgames::SimulatedGameRuntime
An interface that is used to terminate simulation in MCTS and set scores to players....
Definition: SimulatedGameRuntime.hh:17
grail::simgames::SimulatedGameRuntime::SetTerminationRequest
void SetTerminationRequest()
Call this function to indicate that the game has ended, i.e. the terminal conditions have been met.
Definition: SimulatedGameRuntime.cpp:25
grail::simgames::SimulatedGameHelper
Definition: SimulatedGameHelper.h:18
grail::simgames::SimulatedGame
The main interface class for the SimulatedGame reasoner based on the MCTS algorithm....
Definition: SimulatedGame.hh:30
grail::simgames::SimulatedGameRuntime::SetScore
void SetScore(int player, float score)
Sets value in the array of scores indexed by teams. See @teamCount in SimulatedGame constructor or @t...
Definition: SimulatedGameRuntime.cpp:15
grail::simgames::SimulatedGameRuntime::IsTerminationRequest
bool IsTerminationRequest() const
Checks whether the terminationProperty has been set by calling the corresponding setTerminationReques...
Definition: SimulatedGameRuntime.cpp:20
grail::simgames::SimulatedGameNode
This class should not be visible to developers at all.
Definition: SimulatedGameNode.h:25