Reference 〉 Hook

agentStep( Agent agent, Helipad model, int stage )

Runs when the model activates an agent. The main logic of an agent-based model should be hooked here.

This hook generalizes to [primitive]Step, e.g. the step function of an agent with primitive 'bank' would be hooked with bankStep. To hook the step function of agents of all primitives, use baseAgentStep.

The list of agents to be stepped is finalized at the beginning of each stage, so any agent who is alive at the beginning of the stage will be stepped, even in the unusual case that it dies between then and its actual stepping. If this is undesired, if agent.dead: return at the beginning of the hook will prevent this.

Required Parameters

  • agent Agent

    The agent being activated.

  • model Helipad

    The model object.

  • stage int

    The current stage of the model. For single-stage models, this parameter will always pass 1.

Notes and Examples

  1. Contribute a Note

    Your email address will not be published. Required fields are marked *

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.