Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::planner::Action Class Reference

#include <Action.hh>

Public Member Functions

 Action (const ActionTemplate &actionTemplate, std::vector< unsigned int > &&argumentIndices)
 Creates a new Action object based on the template. More...
 
 Action (Action &&other)=default
 
bool IsLegal (const WorldState &worldState) const
 
double GetCost (const WorldState &worldState) const
 
const std::vector< unsigned int > & GetArgumentIndices () const
 
void ApplyToState (WorldState &worldState) const
 
const std::string & GetName () const
 
int GetType () const
 
Actionoperator= (Action &&other)=default
 

Detailed Description

Action object used in planning. Actions are instances constructed based on ActionTemplate. A planning entity takes actions in order to change the world state.

Constructor & Destructor Documentation

◆ Action()

grail::planner::Action::Action ( const ActionTemplate actionTemplate,
std::vector< unsigned int > &&  argumentIndices 
)

Creates a new Action object based on the template.

Parameters
actionTemplate- the template (family/type) of the action; see "ActionTemplate"
argumentIndices- IDs of specific objects that should be assigned as this action's parameters.

Member Function Documentation

◆ ApplyToState()

void grail::planner::Action::ApplyToState ( WorldState worldState) const

Applies the action's logic and modifies the state.

Parameters
worldState- the state to apply the effects of action to.

◆ GetArgumentIndices()

const std::vector< unsigned int > & grail::planner::Action::GetArgumentIndices ( ) const

Returns a collection of IDs of objects that are assigned to the respective action's arguments.

Returns
A collection of IDs of objects that are assigned to the respective action's arguments.

◆ GetCost()

double grail::planner::Action::GetCost ( const WorldState worldState) const

Returns the cost associated with this action. The costs are used by the planner's heuristic.

Parameters
worldState- the current state.
Returns
The cost associated with this action.

◆ GetName()

const std::string & grail::planner::Action::GetName ( ) const

Gets the name of the action.

◆ GetType()

int grail::planner::Action::GetType ( ) const

Gets a unique type ID of the action.

◆ IsLegal()

bool grail::planner::Action::IsLegal ( const WorldState worldState) const

Determines whether the action is legal (available) in the given state.

Parameters
state
Returns
true if the action is legal.

The documentation for this class was generated from the following files: