Diffusion
This behavior diffuses the value(s) of the agent properties specified in the diffusiontargets array. Every step, the value of each property is updated based on the total difference between its neighbors and itself. The diffusioncoef property will determine the rate at which diffusion occurs, with the default, 0.5, meaning that half the total difference is added or removed each step.
Published by
Shortname
@hash/diffusion.rs
Description

This behavior diffuses the value(s) of the agent properties specified in the diffusion_targets array. Every step, the value of each property is updated based on the total difference between its neighbors and itself. The diffusion_coef property will determine the rate at which diffusion occurs, with the default, 0.5, meaning that half the total difference is added or removed each step.

Example

With a behavior that updates its color based on the red, green, and blue properties, this agent will slowly 'absorb' the color from its neighbors:

const colorfulAgent = {
    behaviors: ["diffusion"],
    diffusion_targets: ["],
    diffusion_coef: 0.3
}