Counter
This behavior is essentially a cyclical version of the Aging behavior. Every step of the simulation, the agent’s counter property is incremented by the counterincrement property (the default is 1). When counter is equal to counterresetat, it is set to the value specified in counterreset_to.
Published by
Shortname
@hash/counter.rs
Description

This behavior is essentially a cyclical version of the Aging behavior. Every step of the simulation, the agent’s counter property is incremented by the counter_increment property (the default is 1). When counter is equal to counter_reset_at, it is set to the value specified in counter_reset_to.

If counter is not specified at initialization, it defaults to 0. If either counter_reset_at or counter_reset_to are not specified, then no resetting occurs.

Example

This agent will count from 0 to 2 and back to 0 during the simulation. With a %, you can cause certain behaviors to trigger at regular intervals:

const countingAgent = {
    behaviors: ["counter"],
    counter: 0,
    counter_increment: 1,
    counter_reset_at: 3,
    counter_reset_to: 0
}