AI Toolkit
|
Classes | |
class | aitoolkit::utility::action< T > |
Base abstract class for all actions. More... | |
class | aitoolkit::utility::evaluator< T > |
Evaluate a set of actions and apply the best one. More... | |
Typedefs | |
template<typename T > | |
using | aitoolkit::utility::action_ptr = std::unique_ptr<action<T>> |
Heap allocated pointer to an action. | |
Functions | |
template<typename T , action_trait< T > ... Actions> | |
std::vector< action_ptr< T > > | aitoolkit::utility::action_list (Actions &&... actions) |
Helper function to create a list of actions. | |
Utility AI is a planning algorithm that can be used to find the best action to perform in a given situation. The algorithm works by assigning a score to each action based on how well it will achieve the goal. The algorithm is guaranteed to find a solution.
flowchart TD a1[Collect food\nscore: +50] a2[Collect wood\nscore: +150] a3[Collect stone\nscore: -10] a4[Collect gold\nscore: +75] style a1 color:darkred style a2 color:darkgreen style a3 color:darkred style a4 color:darkred
First, include the header file:
Then, create a blackboard type:
Next, create a class for each action that you want to be able to perform:
Finally, create an evaluator and run it: