(C++)  1.1.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
C45GameActionCounter.h
1 #ifndef GRAIL_C45_GAME_ACTION_COUNTER_H
2 #define GRAIL_C45_GAME_ACTION_COUNTER_H
3 
4 #include "../ISimulatedGameAction.hh"
5 #include <unordered_map>
6 #include <cmath>
7 
8 namespace grail
9 {
10  namespace simulation
11  {
14  {
15  public:
16  void clear();
17 
18  double getTotalSampleCount() const;
19 
20  size_t geKeyCount() const;
21 
22  const ISimulatedGameAction* frequentValue() const;
23 
24  void observeKey(const ISimulatedGameAction* key);
25 
26  double calculateEntropy() const;
27 
28  int getCount(const ISimulatedGameAction* key) const;
29 
30  private:
31  std::unordered_map<const ISimulatedGameAction*, int, HashForOfflineLearning, EqualsForOfflineLearning> sampleCountByKey;
32  double totalSamples = 0;
33  };
34  }
35 }
36 
37 #endif //GRAIL_C45_GAME_ACTION_COUNTER_H
The whole class should be INTERNAL; part of the private interface.
Definition: C45GameActionCounter.h:14
Base class for all actions in SimulatedGame. Derive from it for your actions.
Definition: ISimulatedGameAction.hh:41