Decay
This behavior causes an agent to randomly decay. At every time step this may occur with a likelihood of decaychance. If it is not specified then decaychance defaults to 0.5.
Published by
Shortname
@hash/decay.rs
Description

This behavior causes an agent to randomly decay. At every time step this may occur with a likelihood of decay_chance. If it is not specified then decay_chance defaults to 0.5.

The effect of decaying is dependent on the value of the decay_effect property:

  • If the value is "ModifyDecayed", then the agent's decayed property will be set to true.
  • If the value is "RemoveBehavior", then the agent's decayed property will be set to true, and the Decay behavior will be removed from the agent.
  • If the value is "RemoveAgent", then the agent will be removed from the simulation.

Example

Each time step, this agent has a 10% chance of decaying:

const decayingAgent = {
    behaviors: ["decay"],
    decayed: false,
    decay_chance: 0.1
}