class Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>
package needs.ai
The Reasoner class encapsulates sets of actions available to an agent. It exposes a technique for selecting the best available Action from a collection of ActionSets. It emits a signal when the Action it selects changes.
Constructor
Variables
read onlyactionSets:Array<ActionSet<ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>> = null
The sets of actions available to the reasoner.
lastAction:Action<ActionIdType, ConsiderationIdType, InputIdType> = null
The last action the reasoner selected.
read onlyname:String = ""
Human-readable name of the reasoner. Reasoners for an agent like a hungry NPC-eating werewolf might be named for context-specific sets of actions they encapsulate e.g. "Wilderness Action Sets", "Town Action Sets" etc.
onActionChanged:Signal3<Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>, Action<ActionIdType, ConsiderationIdType, InputIdType>, Action<ActionIdType, ConsiderationIdType, InputIdType>> = null
Signal emitted when the action selected by the reasoner changes.
selectAction:Void ‑> ActionScorePair<ActionIdType, ConsiderationIdType, InputIdType> = null
Returns the most appropriate action from the sets by evaluating the actions using the reasoner's action picking strategy.
Returns:
The most appropriate action in the set and its score.
selectActionSet:Void ‑> Array<ActionSetScorePair<ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>> = null
Returns the action sets sorted by their appropriateness by evaluating the sets using the reasoner's action set picking strategy.
Returns:
The most appropriate action sets and their scores.