(C++)  1.0.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Action.hh
1 #ifndef GRAIL_ACTION_H
2 #define GRAIL_ACTION_H
3 
4 #include "ActionTemplate.hh"
5 
6 namespace grail
7 {
8  namespace planning
9  {
10  class Action
11  {
12  public:
13  Action(const ActionTemplate& actionTemplate, std::vector<unsigned int>&& argumentIndices);
14  Action(Action&& other) = default;
15  ~Action() = default;
16 
17  bool IsLegal(const WorldState& worldState) const;
18  double GetCost(const WorldState& worldState) const;
19  const std::vector<unsigned int>& GetArgumentIndices() const;
20  void ApplyToState(WorldState& worldState) const;
21  const std::string& GetName() const;
22  int GetType() const;
23  Action& operator=(Action&& other) = default;
24 
25  private:
26  const ActionTemplate* actionTemplate;
27  std::vector<unsigned int> argumentIndices{};
28  static thread_local std::vector<WorldObject*> effectFunctionArguments;
29  static thread_local std::vector<const WorldObject*> preconditionFunctionArguments;
30  };
31  }
32 }
33 
34 #endif //GRAIL_ACTION_H
Definition: Action.hh:11
A class representing an action that can be simulated by grail planner.
Definition: ActionTemplate.hh:21
A class representing planner world state.
Definition: WorldState.hh:15