set_task: Set the task for an agent or a list of agents

Description Usage Arguments Value Examples

View source: R/agent.R

Description

Set the task for a single agent, or for a list of agents, which will be executed for each time step when the simulation is run. The task function must take the arguments agent and population and must return agent

Usage

1
set_task(x, task, agent_type = "agent")

Arguments

x

An agent or a list of agents

task

A function to be executed in each time step. You must pass agent and population as arguments to the function (see example below)

Value

The original agent or agent list 'x', with tasks appended

Examples

1
#Build an example simulation in which each agent moves and then prints its coordinates to the console in each time step

neilcharles/agentSim documentation built on Oct. 31, 2020, 11:23 a.m.