StarLogo Vocabulary:


Looping over Turtles and Patches


= used for the observer,
= used for turtles,
= used for patches


_____________________________________________________________
count-color
number
better to use: count-turtles-with[color=number]

Reports the number of turtles with the color number. Names of colors can be used
(since they evaluate to corresponding color numbers).

Example:
show color-count red
(Prints the number of red turtles.)
_____________________________________________________________
count-color-range
color1 color2
or: count-turtles-with[color >= color1 and color <= color2]

Counts how many turtles have a color between color1 and color2.
_____________________________________________________________
count-pc-range
color1 color2

Counts how many patches have a color between color1 and color2.
_____________________________________________________________
count-turtles

count-turtles-with list
count-turtles-at
count-turtles-here

Reports the number of turtles.

count-turtles-with counts the number of turtles with list where list is true. _____________________________________________________________
max-of-turtles[var], max-of-patches[var]
variable

Reports the maximum value of variable (over all turtles or patches).

variable can be either a patch variable or a turtle variable.

Example:
show max-of-turtle[age]
(Prints the maximum value for the variable age over all turtles.)
_____________________________________________________________
max-of-turtles
list
max-of-frogs list
max-of-patches list

Returns the max value of turtles of proc list. If there are no frogs/turtles/patches, returns minnum. _____________________________________________________________
max-of-turtles-with
list1 list2
max-of-frogs-with list1 list2
max-of-patches-with list1 list2

Returns max of turtles/frogs/patches with list1 true of list2.
If nothing satisfies list1 returns minnum.
_____________________________________________________________
min-of-turtles[var], min-of-patches[var]
variable

Reports the minimum value of variable (over all turtles or patches).

variable can be either a patch variable or a turtle variable.

Example:
show min-of-turtle[age]
(Prints the minimum value for the variable age over all turtles.)
_____________________________________________________________
min-of-turtles-with
ilist1 ilist2

Reports the minimum value of ilist2 over all turtles who satisfy ilist1.
_____________________________________________________________
min-of-patches-with
ilist1 ilist2

Reports the minimum value of ilist2 over all patches who satisfy ilist1.
_____________________________________________________________
myself

Reports who of turtle running the max-of-turtle command.
_____________________________________________________________
one-of-turtles

one-of-turtles-at xcor ycor
one-of-turtles-here
one-of-turtles-with list

Picks a random turtle that satisfies one of the four conditions.
_____________________________________________________________
count-pc
color
(patch color count)
better to use: count-patches-with[color=number]

Reports the number of patches with the given color.

Example:
show pc-count green
(Prints the number of green patches.)
_____________________________________________________________
sum-of-turtles[var], sum-of-patches[var]
variable

Reports the sum of the values of variable over all turtles (or over all patches,
if variable is a patch variable).

Example:
show sum-of-turtles[age] (Prints the sum of all of the turtles' ages.)
_____________________________________________________________
turtle-total

Reports the total number of turtles.
_____________________________________________________________
who-max-of-turtles
list
who-max-of-turtles-with list1 list2
Reports who of turtle with max value of list. If none, it reports -1.
=============================================================