Returns either a single agent object by ID, or a subset of agents by breed. To return all agents, use model.allagents.
Parameters
var — str|int, required
If
var
is a breed name, the function returns a list of all agents of that breed. Ifvar
is an int, the function returns the agent with that id.primitive — str, optional
If
var
is a breed name,primitive
specifies which primitive's breed to return. A value ofNone
will select the first primitive in order, usually'agent'
unless that primitive has been removed or reordered.Default value: None
Return Value — Agent|list[Agent]
An Agent
object with agent.id==var
if var
is an int (or None
if no agent matched the ID); otherwise a list of Agent
objects with agent.breed==var
.
charwick
Mar 24, 2020 at 3:24A few examples:
If you want agents of all breeds of a particular primitive, you can access the
model.agents
property directly. If you want all agents of all primitives, usemodel.allagents
.