Skip to content

assign_agent_to_place

Syntax

assign_agent_to_place(place, site_id, agent_id)

Parameters

place
A valid place name
site_id
An expression that evaluates to a valid site ID.
agent_id
An expression that evaluates to a valid ordinary agent ID.

Description

The agent with ID agent_id joins a specific site with ID site_id within the place specified by place.

If the agent already belongs to group of the given type, the agent first quits that group before joining the specified group. If the group already reached maximum size, the action has no effect.

A runtime error occurs if either argument does not evaluate to a valid ID.

Examples

A mother agent can enroll a child agent in her home as follows:

place home {
  site = 0, 0, 0
  site = 300, 10, 20
}

new_agent_id = spawn_agent()
assign_agent_to_place(home, 0, new_agent_id)

new_agent_id2 = spawn_agent()
assign_agent_to_place(home, 300, new_agent_id2)

See Also