3 #ifndef GRAIL_SIMULATED_GAME_NODE_H
4 #define GRAIL_SIMULATED_GAME_NODE_H
8 #include <unordered_map>
10 #include "ISimulatedGameAction.hh"
11 #include "SimulatedGameActionMetadata.hh"
13 using RandomGenerator = std::mt19937_64;
19 class SimulatedGameThinkingUnit;
20 class ISimulatedGameUnit;
21 class SimulatedGameSnapshotObserver;
22 struct SimulatedGameHelper;
31 void Backpropagate(
float score);
40 RandomGenerator& rand_gen,
44 std::vector<SimulatedGameActionMetadata> GetActionsWithMetadata()
const;
45 void FillPlan(std::unordered_map<
const ISimulatedGameUnit*, std::vector<const ISimulatedGameAction*>>& plan,
47 void FillPlanWithMetadata(
48 std::unordered_map<
const ISimulatedGameUnit*, std::vector<SimulatedGameActionMetadata>>& plan,
50 void FillPath(std::vector<std::pair<const ISimulatedGameUnit*, const ISimulatedGameAction*>>& path)
const;
55 double GetVisits()
const;
57 std::vector<std::unique_ptr<SimulatedGameNode>> children{};
59 bool IsTerminal()
const;
61 size_t GetBestActionIndex()
const;
64 double totalScore = 0.0;
66 std::vector<std::unique_ptr<const ISimulatedGameAction>> actions{};
67 std::vector<double> terminalScores{};
75 #endif //GRAIL_SIMULATED_GAME_NODE_H