The Brain class represents the top-level reasoning element of your utility-based AI agent. It encapsulates a collection of Reasoners, which it updates to drive decision-making logic of the agent. The Brain broadcasts when the actions its reasoners pick change, which other parts of the codebase e.g. an animation system, can listen to.

Constructor

new (id:BrainIdType, reasoners:Array<Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>>)

Parameters:

reasoners

The collection of reasoners that the brain starts with.

Variables

read onlyid:BrainIdType = null

Id for this brain.

read onlyinstanceId:Int = InstanceId.makeId()

Id for this object.

read onlyonActionChanged:Signal3<Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>, Action<ActionIdType, ConsiderationIdType, InputIdType>, Action<ActionIdType, ConsiderationIdType, InputIdType>> = null

Callback triggered when a reasoner changes the action that it has selected.

read onlyonReasonerAdded:Signal2<Brain<BrainIdType, ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>, Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>> = null

Callback triggered when a reasoner is added to the brain.

read onlyonReasonerRemoved:Signal2<Brain<BrainIdType, ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>, Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>> = null

Callback triggered when a reasoner is removed from the brain.

Methods

addReasoner (reasoner:Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>):Void

Adds a reasoner to the brain.

Parameters:

reasoner

The reasoner to add.

removeReasoner (reasoner:Reasoner<ReasonerIdType, ActionSetIdType, ActionIdType, ConsiderationIdType, InputIdType>):Void

Removes a reasoner from the brain, if it is present in the brain.

Parameters:

reasoner

The reasoner to remove.

update ():Void

Updates the reasoners in the brain.