Skip to main content

Interface: BotNeuron<S>

Type parameters

NameType
Sextends State

Properties

action

action: ActionDefinition<S>

ActionDefinition associated with this Neuron.


children

Optional children: BotNeuron<S>[]

Child neurons of this one.

FIXME: Verify programmatically, that you defined either action OR neurons...

TODO: BotNeuron Definition Parser?


conditions

Optional conditions: (test: ClientMessageConditions<S>, context: ClientMessageContext<S>) => void

Type declaration

▸ (test, context): void

Additional conditions to notify bot if it can perform this action.

API of Conditions here is limited on purpose, you can only assess current player (eg. for ownership) and game state.

Optional, but without this, bot will brute force its way through all game elements to understand if this action can be played.

Parameters
NameType
testClientMessageConditions<S>
contextClientMessageContext<S>
Returns

void


description

Optional description: string


entitiesFilter

Optional entitiesFilter: (test: BotEntityAuxConditions<S>, context: BotEntityAuxContext<S>) => void | QuerableProps[]

If your action targets entities too broadly, add additional filter here.

Can simply be additional QuerableProps object, or more advanced function of conditions - subject is automatically set to each entity.


name

name: string


playerEventData

Optional playerEventData: (context: ClientMessageContext<S>) => any

Type declaration

▸ (context): any

Make bot generate additional data, if needed. Will be passed to ClientPlayerMessage.data

Parameters
NameType
contextClientMessageContext<S>
Returns

any


thinkScale

Optional thinkScale: number

Scale up/down the time it takes the bot to act on this neuron.


value

value: (context: ClientMessageContext<S>) => number

Type declaration

▸ (context): number

With higher values bot is more likely to pick that Neuron.

Bots may try to pick the same child-Neuron multiple times in a row, if the game still allows it (eg.: picking multiple cards of the same rank).

Optional, by default the value is considered to be 0.

Parameters
NameType
contextClientMessageContext<S>
Returns

number