Complete Command List (Printable)
You can classify turtles into different breeds.
To create two breeds called frogs and crabs, for instance,
you type the command
breeds
[frogs crabs]
in either the turtle procedure window or the observer procedure window (but not both).
ask-frogs ilist [Observer]
Asks all turtles of breed frogs to run ilist. The
observer will wait for all of the turtles to finish before continuing.
breed [Turtle]
Returns the turtle's breed.
breed-at xcor ycor [Observer, Turtle]
Reports the breed of the turtle xcor units in the x direction
and ycor units in the y direction away from the caller.
breed-of number [Observer, Turtle]
Reports the breed of the turtle with ID Number number.
breed-towards angle distance [Observer, Turtle]
Reports the breed of the turtle distance away at an angle of
angle.
count-frogs [Observer, Turtle]
Returns the number of turtles whose breed is frogs.
count-frogs-at xcor ycor [Observer, Turtle]
Returns the number of turtles whose breed is frogs which are xcor
units in the x direction and ycor units in the y direction away
from the caller .
count-frogs-here [Turtle]
Returns the number of turtles whose breed is frogs which are on
the current patch.
count-frogs-towards angle distance [Observer, Turtle]
Returns the number of turtles whose breed is frogs which are located
at the patch distance away at angle angle.
count-frogs-with [ilist] [Observer, Turtle]
Returns the number of turtles whose breed is frogs and satisfy
the conditions (must return a boolean of true or false) specified by the ilist.
Sample usage:
count-frogs-with [color = blue]
create-frogs number [Observer]
Creates number of turtles and assigns frog as their breed.
create-frogs-and-do number list to run [Observer]
Creates number of turtles and assigns frogs as their breed.
The turtles then execute list to run.
if breed = frogs [Turtle]
Returns true if the breed of the turtle invoking
this command is frogs
list-of-frogs [Observer, Turtle]
Returns a list of turtles of breed frogs.
list-of-frogs-at xcor ycor [Observer, Turtle]
Returns a list of turtles of breed frogs xcor units
in the x direction and ycor units in the y direction away from
the caller.
list-of-frogs-here [Turtle]
Returns a list of turtles of breeds frogs on the caller's patch.
list-of-frogs-towards angle distance [Observer, Turtle]
Returns a list of turtles of breed frogs at the patch distance
away at angle angle.
list-of-frogs-with condition [Observer, Turtle]
Returns a list of turtles of breed frogs satisfying condition.
max-of-frogs-with pred-ilist ilist [Observer, Turtle]
Reports the highest value of ilist when run over the turtles
of breed frogs that satisfy pred-ilist. If there are
no frogs in which pred-ilist is true, returns minnum,
the smallest number possible without going into negative infinity. Note: This
command can also be executed by patches, for example within an ask-patches
statement.
min-of-frogs-with pred-ilist ilist [Observer, Turtle]
Reports the lowest value of ilist when run over the turtles of
breed frogs that satisfy pred-ilist. If there are
no frogs in which pred-ilist is true, returns maxnum,
the largest number possible without going into positive infinity. Note: This
command can also be executed by patches, for example within an ask-patches
statement
one-of-frogs-at xcor ycor [Observer, Turtle]
Returns a random turtle of breed frogs xcor units
in the x direction and ycor units in the y direction away from
the caller.
one-of-frogs-here [Turtle]
Returns a random turtle of breed frogs on the caller's patch
other than the caller.
one-of-frogs-towards angle distance [Observer, Turtle]
Returns a random turtle of breed frogs at the patch distance
away at angle angle.
setbreed breedname [Turtle]
Turtles set their breed to breedname.
setbreed-at xcor ycor breedname [Observer, Turtle]
Sets the breed of the turtle xcor units in the x direction and
ycor units in the y direction away from the caller to breedname.
See the breeds reference for more information.
setbreed-of number breedname [Observer, Turtle]
Sets the breed of the turtle with ID Number number to breedname.
See the breeds reference for more information.
setbreed-towards angle distance breedname [Observer,
Turtle]
Sets the breed of the turtle distance away in the direction angle
to breedname.
See the breeds reference for more information.
sum-of-frogs ilist [Observer, Turtle]
Reports the total of evaluating ilist in every frog and adding
it up.
sum-of-frogs-with pred-ilist ilist [Observer, Turtle]
Reports the total value of ilist when run over the turtles of
breed frogs that satisfy pred-ilist. If there are
no frogs in which pred-ilist is true, returns 0. Note:
This command can also be executed by patches, for example within an ask-patches
statement.
Example: sum-of-frogs-with (color = green) [age] returns the sum
of all of the ages of the green frogs.