Some useful commands and functions
See docs
-
breed [cars car]
: Define new objects. Here calledcars
-
globals var1, var1
: Define global variables -
cars-own [A B]
: Define properties A and B forcar
-
heading angle
,\text{angle} \in [0, 360]
- 0 is north
- 90 is east
- ...
-
myself
: -
self
: -
distance
: Reports the distance from this agent to the given car or patch. -
cars-own [keywords]
: properties of car -
fd(1)
: move forward with 1 -
ask agentset [commands]
orask agent [commands]
-
let variable value
: create local variable with value -
agentset with-min [reporter]
: Reports a new agentset containing only those agents that have the minimum value of the given reporter. -
set-current-plot name
: choose plot window -
set-plot-y-range min max
: set range of plot in y-axis. dito forset-plot-x-range
-
ifelse reporter [cmd1] [cmd2]
: If reporter reports true, runs cmd1 else cmd2 -
who
: id of car -
random-float N
:- random number
\in [0, N[\; \text{if}\; N > 0
- or random number
]N, 0]\; \text{if}\; N < 0
- random number
-
list value1 value2
: Reports a list containing the given items. -
(list value1 ...)
: dito -
to-report
: Used to begin a reporter procedure. The body of the procedure should use report to report a value for the procedure. -
random-normal mean std
: Reports an accordingly distributed random number with the mean and, in the case of the normal distribution, the standard-deviation