1 #ifndef GRAIL_SIMULATED_GAME_NODE_H
2 #define GRAIL_SIMULATED_GAME_NODE_H
6 #include <unordered_map>
8 #include "ISimulatedGameAction.hh"
9 #include "SimulatedGameActionMetadata.hh"
11 using RandomGenerator = std::mt19937_64;
17 class SimulatedGameThinkingUnit;
18 class ISimulatedGameUnit;
19 class SimulatedGameSnapshotObserver;
20 struct SimulatedGameHelper;
29 void Backpropagate(
float score);
38 RandomGenerator& rand_gen,
42 std::vector<SimulatedGameActionMetadata> GetActionsWithMetadata()
const;
43 void FillPlan(std::unordered_map<
const ISimulatedGameUnit*, std::vector<const ISimulatedGameAction*>>& plan,
45 void FillPlanWithMetadata(
46 std::unordered_map<
const ISimulatedGameUnit*, std::vector<SimulatedGameActionMetadata>>& plan,
48 void FillPath(std::vector<std::pair<const ISimulatedGameUnit*, const ISimulatedGameAction*>>& path)
const;
53 double GetVisits()
const;
55 std::vector<std::unique_ptr<SimulatedGameNode>> children{};
57 bool IsTerminal()
const;
59 size_t GetBestActionIndex()
const;
62 double totalScore = 0.0;
64 std::vector<std::unique_ptr<const ISimulatedGameAction>> actions{};
65 std::vector<float> terminalScores{};
73 #endif //GRAIL_SIMULATED_GAME_NODE_H