Command List
All of these commands are created when you declare your turtles to have breeds, using the breeds
command. For each command in this listing, replace the word 'breed' by the actual name of the breed you have created. For example,
breeds [frogs toads]
to go
create-frogs 100
create-toads-and-do 100 [if count-frogs > 50 [setc brown]]
end
ask-breed
[list of commands]
Parameters:
[list of commands] |
List of turtle commands |
A list of turtle commands to run |
Description:
Asks all turtles of breed frogs
to run [list of commands]
. The observer will wait for all of the turtles to finish before continuing.
Examples:
ask-frogs [fd 1 rt 90]
will make all turtles of breed frogs
move forward one step and then turn 90 degrees to the right.
Related Commands:
ask-breed-with
ask-list-of-turtles
ask-patch-at
ask-patches
ask-turtle
ask-turtles
ask-turtles-with
ask-breed-with
[condition] [list-of-commands]
Parameters:
[condition] |
List of commands |
list of commands that evaluates to either true or false |
[list-of-commands] |
List of turtle commands |
list of commands to run |
Description:
This observer command asks all of the turtles of the breed specified that satisfy [condition] to run the [list-of-commands]. The observer will wait for the turtles to finish before moving on.
Examples:
ask-frogs-with [color = green] [fd 1]
has all of the turtles of color green and breed frogs move forward 1
Related Commands:
ask-breed
average-of-breed
[list of commands]
Parameters:
[list of commands] |
List of turtle commands |
A list of commands for the frogs to run which returns a number |
Description:
Returns the numerical average of the [list of commands] when evaluated across all the turtles of breed frogs
.
Examples:
average-of-frogs [speed]
returns the average speed of all the turtles of breed frogs.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
average-of-breed-with
average-of-patches
average-of-turtles
max-of-breed
median-of-breed
min-of-breed
mode-of-breed
sum-of-breed
variance-of-breed
average-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of turtle commands |
An expression that returns a true or false value |
[list of commands] |
List of turtle commands |
A list of commands for the turtles to run which returns a number |
Description:
Returns the numerical average of the [list of commands] when evaluated across all the turtles of breed frogs
that satisfy the condition (must return a boolean of true or false) specified by the [condition].
Examples:
average-of-frogs-with [color = red] [speed]
returns the average speed of all the red turtles of breed frogs.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
average-of-breed
average-of-patches-with
average-of-turtles-with
max-of-breed-with
median-of-breed-with
min-of-breed-with
mode-of-breed-with
sum-of-breed-with
variance-of-breed-with
breed
Description:
Returns the turtle's breed, or if a patch is calling it, the breed of one of the turtles on the patch.
Examples:
if breed = frogs [fd 5]
makes all turtles of breed frogs
move forward 5 steps.
Related Commands:
breed-at
breed-of
breed-towards
setbreed
who
breed-at
xcor ycor
Parameters:
xcor |
Number |
offset in the x direction |
ycor |
Number |
offset in the y direction |
Description:
Reports the breed of the turtle xcor units in the x direction and ycor units in the y direction away from the caller.
Examples:
breed-at 5 7
returns the breed of the turtle 5
units to the right and 7
units up from the caller.
Related Commands:
breed
breed-of
breed-towards
setbreed-at
breed-of
number
Parameters:
number |
Integer |
id number of the turtle |
Description:
Reports the breed of the turtle with ID number.
Examples:
if breed-of 4 = frog [fd 1]
makes all the turtles move one step forward if the turtle which who number 4
is of breed frog
.
Related Commands:
breed
breed-at
breed-towards
setbreed-of
breed-towards
angle distance
Parameters:
angle |
Number |
|
distance |
Number |
|
Description:
Reports the breed of the turtle distance
away at an angle
of angle.
Examples:
breed-towards 0 1
returns the breed of the turtle one patch ahead of the patch or turtle given the instruction.
Related Commands:
breed
breed-at
breed-of
setbreed-towards
breeds
[breed1 breed2 ...]
Parameters:
[breed1 breed2 ...] |
List or string |
A list of breed names (usually plural) |
Description:
At the top of the Observer or Turtle command centers, place this command:
breeds [frogs toads]
to declare your turtles to have two different breeds, frogs
and toads
. Once you have done this, you may use any command in the Breeds
category to run only on the breed of turtles that you have created.
Examples:
breeds [frogs toads]
to setup
create-frogs 100
create-toads 40
ask-frogs [hop]
ask-toads [ribbit]
end
Related Commands:
patches-own
turtles-own
count-breed
Description:
Returns the number of turtles whose breed is frogs.
Related Commands:
count-breed-at
count-breed-here
count-breed-towards
count-breed-with
count-turtles
count-breed-at
xcor ycor
Parameters:
xcor |
Number |
units in the x direction away from the caller |
ycor |
Number |
units in the y direction away from the caller |
Description:
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.
Related Commands:
count-breed
count-breed-here
count-breed-towards
count-breed-with
count-turtles-at
count-breed-at-with
xcor ycor [condition]
Parameters:
xcor |
Number |
number of steps in the x-direction from the caller |
ycor |
Number |
number of steps in the y-direction from the caller |
[condition] |
List of turtle commands |
list of commands that returns true or false |
Description:
Returns the number of turtles of the breed specified that are xcor units away in the x-direction and ycor units away in the y-direction from the caller, and also satisfy [condition].
Examples:
if count-cars-at-with 1 1 [color = red] > 1 [fd 1]
will have all of the turtles move forward who have more than one red turtle of breed cars 1 unit away in the x-direction and 1 unit away in the y-direction
count-breed-here
Description:
Returns the number of turtles whose breed is frogs which are on the current patch.
Examples:
if count-frogs-here > 2 [setc blue]
makes the turtle set its color to blue if there are more than two turtles of type frog on its current patch.
Related Commands:
count-breed
count-breed-at
count-breed-towards
count-breed-with
count-turtles-here
count-breed-here-with
[condition]
Parameters:
[condition] |
List of turtle commands |
list of commands that evaluates to either true or false |
Description:
Returns the number of turtles of the breed specified on the caller's patch that meet the condition specified in [condition].
Examples:
if count-cars-here-with [color = red] > 1 [fd 1]
This will cause all of the turtles on a patch with more than one red turtle of the breed cars on it to move forward one.
count-breed-towards
angle distance
Parameters:
angle |
Number |
angle from the direction the caller is facing |
distance |
Number |
distance away from the caller |
Description:
Returns the number of turtles whose breed is frogs which are located at the patch distance away at angle angle.
Examples:
count-frogs-towards 0 1
returns the number of turthles whose breed is frogs one patch ahead of the caller.
Notes:
Note the angle is measured from the direction the caller is facing.
Related Commands:
count-breed
count-breed-at
count-breed-here
count-breed-with
count-turtles-towards
count-breed-towards-with
angle distance [condition]
Parameters:
angle |
Number |
angle from caller |
distance |
Number |
distance from caller |
[condition] |
List of turtle commands |
list of commands that returns true or false |
Description:
Returns the number of turtles of the breed specified that are distance units away at an angle of angle from the caller, that also satisfy [condition].
Examples:
if count-molecules-towards 0 1 [color = blue] > 1 [fd 1]
will have all of the turtles with more than one blue turtle of breed molecules directly in front of them move forwards one space.
count-breed-with
[list of commands]
Parameters:
[list of commands] |
List of commands |
condition to determine whether a frog is counted |
Description:
Returns the number of turtles whose breed is frogs and satisfy the conditions (must return a boolean of true or false) specified by [list of commands].
Examples:
count-frogs-with [color = blue]
returns the number of blue frogs.
Related Commands:
count-breed
count-breed-at
count-breed-here
count-breed-towards
count-turtles-with
create-breed
number
Parameters:
number |
Number |
number of turtles to create |
Description:
Creates number of turtles and assigns breed as their breed.
Examples:
create-frogs 2
creates two turtles of breed frogs.
create-cars 5
creates five turtles of breed cars.
Related Commands:
create-breed-and-do
create-custom-turtles
create-turtles
create-breed-and-do
number [list-of-commands]
Parameters:
number |
Number |
number of turtles to create |
[list-of-commands] |
List of commands |
commands for newly created turtles to run |
Description:
Creates number of turtles and assigns breed as their breed. The turtles then execute [list-of-commands].
Examples:
create-frogs-and-do 5 [fd 3]
would create 5 turtles of breed frogs and make them all move forward 3 steps.
Related Commands:
create-breed
create-turtles-and-do
list-of-breed
Description:
Returns a list of the who numbers of the turtles of the breed specified by
breed
.
Examples:
list-of-frogs
returns a list of all of the turtles of breed frogs
list-of-cars
returns a list of all of the turtles of breed cars
Related Commands:
list-of-breed-at
list-of-breed-here
list-of-breed-towards
list-of-breed-with
list-of-turtles
list-of-breed-at
xcor ycor
Parameters:
xcor |
Number |
number of units away in the x direction |
ycor |
Number |
number of units away in the y direction |
Description:
Returns a list of the who numbers of the turtles of the breed specified by breed
xcor units in the x direction and ycor units in the y direction away from the caller.
Examples:
list-of-frogs-at 1 1
returns a list of the who numbers of the turtles of breed frogs one unit to the right and one unit above the caller.
list-of-cars-at 3 5
returns a list of the who numbers of the turtles of breed cars three units to the right and five units above the caller.
Related Commands:
list-of-breed
list-of-turtles-at
list-of-turtles-at-with
list-of-breed-at-with
xcor ycor [condition]
Parameters:
xcor |
Number |
number of steps in the x-direction from the caller |
ycor |
Number |
number of steps in the y-direction from the caller |
[condition] |
List of turtle commands |
list of commands that returns true or false |
Description:
Returns a list of all of the turtles of the breed specified xcor units away in the x-direction and ycor units away in the y-direction from the caller that also satisfy [condition].
Examples:
set blue_balloons list-of-balloons-at-with 1 1 [color = blue]
will set the variable blue_balloons
to a list of the who numbers of all of the blue turtles of breed balloons one unit away in the x-direction and one unit away in the y-direction from the caller.
Related Commands:
list-of-breed-here-with
list-of-breed-towards-with
list-of-turtles-at-with
list-of-breed-here
Description:
Returns a list of turtles of the breed specified by breed
on the caller's patch.
Examples:
list-of-frogs-here
returns a list of turtles of breed frogs
on the caller's patch.
list-of-cars-here
returns a list of turtles of breed cars
on the caller's patch.
Related Commands:
list-of-breed
list-of-breed-here-with
list-of-turtles-here
list-of-breed-here-with
[condition]
Parameters:
[condition] |
List of turtle commands |
list of commands that evaluates to either true or false |
Description:
Returns the a list of the turtles of the breed specified on the caller's patch that meet the condition specified in [condition].
Examples:
set blue_balloons list-of-balloons-here-with [color = blue]
will set the variable blue_balloons
to a list of all of the blue turtles' who numbers of the breed ballons that are the same patch as the caller.
Related Commands:
list-of-breed-at-with
list-of-breed-here
list-of-breed-towards-with
list-of-turtles-here-with
list-of-breed-towards
angle distance
Parameters:
angle |
Number |
angle from the caller |
distance |
Number |
distance away from the caller |
Description:
Returns a list of the who numbers of the turtles of the breed specifed by breed
at the patch angle away at angle distance from the caller.
Examples:
list-of-frogs-towards 0 1
returns a list of the turtles of breed frog directly ahead and one patch away from the caller.
list-of-cars-towards 90 5
returns a list of the turtles of breed cars 90 degreses to the right and five patches away from the caller.
Related Commands:
list-of-breed
list-of-breed-towards-with
list-of-turtles-towards
list-of-breed-towards-with
angle distance [condition]
Parameters:
angle |
Number |
angle from caller |
distance |
Number |
distance from caller |
[condition] |
List of turtle commands |
list of commands that returns true or false |
Description:
Returns a list of all of the turtles of the breed specified distance units away at an angle angle from the caller who also satisfy [condition].
Examples:
set red_cars list-of-cars-towards-with 0 1 [color = red]
will set the variable red_cars
to a list of the who numbers of all of the red turtles of breed cars one unit away and directly in front of the caller.
Related Commands:
list-of-breed-at-with
list-of-breed-here-with
list-of-breed-towards
list-of-turtles-towards-with
list-of-breed-with
[condition]
Parameters:
[condition] |
List of turtle commands |
list of commands that evaluates to true or false |
Description:
Returns a list of turtles of breed indicated by breed
satisfying condition
.
Examples:
list-of-frogs-with [color = green]
will return a list of turtles that are breed frogs
and have color green
.
list-of-cars-with [color = black]
will return a list of turtles that are breed cars
and have color black
.
Notes:
Note [condition] must be a boolean statement and return true or false.
Related Commands:
list-of-breed
list-of-turtles-with
max-of-breed
[list of commands]
Parameters:
[list of commands] |
List of commands |
list of commands that evaluate to a number |
Description:
Reports the highest value of [list of commands] when run over the turtles of the breed specified by breed
.
Examples:
max-of-frogs [speed]
returns the turtle of breed frogs
with the highest value of speed
.
max-of-cars [size]
returns the turtle of breed cars
with the highest value of size
.
Notes:
This command can also be executed by patches, for example within an ask-patches
statement.
If [list of commands]
contains no numbers, the smallest possible number is returned. If some of the [list of commands]
, when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed
max-of-turtles
median-of-breed
min-of-breed
mode-of-breed
sdev-of-breed
sum-of-breed
variance-of-breed
max-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of commands |
list of commands that evaluates to true or false |
[list of commands] |
List of commands |
list of commands that evaluate to a number |
Description:
Reports the highest value of [list of commands] when run over the turtles of breed specified by breed
that satisfy [condition]. If there are no turtles of this breed for which [condition] is true, returns minnum
, the smallest number possible without going into negative infinity.
Examples:
max-of-frogs-with [color = red] [speed]
returns the red turtle with the greatest speed of breed frogs
.
max-of-cars-with [color = blue] [size]
returns the blue turtle with the greatest size of breed cars
.
Notes:
This command can also be executed by patches, for example within an ask-patches
statement.
If [list of commands]
contains no numbers, the smallest possible number is returned. If some of the [list of commands]
, when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed-with
median-of-breed-with
min-of-breed-with
min-of-turtles-with
mode-of-breed-with
sdev-of-breed-with
sum-of-breed-with
variance-of-breed-with
median-of-breed
[list of commands]
Parameters:
[list of commands] |
List of commands |
list of commands that evaluate to a number |
Description:
Returns the median of the [list of commands] when evaluated across all the turtles of the specified breed.
Examples:
median-of-frogs [speed]
returns the median speed of all the turtles of breed frogs.
median-of-cars [size]
returns the median size of all the turtles of breed cars.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed
max-of-breed
median-of-turtles
min-of-breed
mode-of-breed
sdev-of-breed
sum-of-breed
variance-of-breed
median-of-breed-with
[1st list of commands] [2nd list of commands]
Parameters:
[1st list of commands] |
List of commands |
list of commands that evaluates to true or false |
[2nd list of commands] |
List of commands |
list of commands that evaluate to a number |
Description:
Returns the median of the [2nd list of commands] when evaluated across all the turtles of the breed specified that satisfy the conditions specified by the [1st list of commands].
Examples:
median-of-frogs-with [color = red] [speed]
returns the median speed of all the red turtles of breed frogs.
median-of-cars-with [size > 4] [speed]
returns the median speed of all the turtles of size greater than 4 with breed cars.
Notes:
If [2nd list of commands] contains no numbers, an error occurs. If some of the [2nd list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed-with
max-of-breed-with
median-of-turtles-with
min-of-breed-with
mode-of-breed-with
sdev-of-breed-with
sum-of-breed-with
variance-of-breed-with
min-of-breed
[list of commands]
Parameters:
[list of commands] |
List of turtle commands |
list of commands that evaluate to a number |
Description:
Reports the lowest value of [list of commands] when run over the turtles of the breed specified by breed
.
Examples:
min-of-frogs [speed]
reports the speed of the slowest turtle of breed frog.
min-of-cars [mileage]
reports the mileage of the turtle of breed car with the lowest mileage.
Notes:
Note: This command can also be executed by patches, for example within an ask-patches
statement.
Note: If [list of commands] contains no numbers, the greatest possible number is returned. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
Note: When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed
max-of-breed
median-of-breed
min-of-breed-with
mode-of-breed
sdev-of-breed
sum-of-breed
variance-of-breed
min-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of turtle commands |
list of commands that evaluates to true or false |
[list of commands] |
List of turtle commands |
list of commands to that evaluate to a number |
Description:
Reports the lowest value of [list of commands] when run over the turtles of the breed specified that satisfy [condition]. If there are no turtles of the breed specified in which [condition] is true, returns maxnum, the largest number possible without going into positive infinity.
Examples:
min-of-frogs-with [habitat = tree] [height]
reports the height of the shortest turtle of breed frog with habitat tree.
min-of-cars-with [color = red] [speed]
reports the speed of the slowest red turtle of breed car.
Notes:
Note: This command can also be executed by patches, for example within an ask-patches statement.
Note: If [condition] contains no numbers, the greatest possible number is returned. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
Note: When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed-with
max-of-breed-with
median-of-breed-with
min-of-breed
mode-of-breed-with
sdev-of-breed-with
sum-of-breed-with
variance-of-breed-with
mode-of-breed
[list of commands]
Parameters:
[list of commands] |
List of commands |
list of commands that evaluate to a number |
Description:
Returns the mode of the [list of commands] when evaluated across all the turtles of breed specified by breed.
Examples:
mode-of-frogs [speed]
returns the mode of the speed of all the turtles of breed frogs.
Notes:
Note: If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
Note: If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
Note: When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed
max-of-breed
median-of-breed
min-of-breed
mode-of-breed-with
mode-of-turtles
sdev-of-breed
sum-of-breed
variance-of-breed
mode-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of turtle commands |
list of commands that evaluate to true or false |
[list of commands] |
List of turtle commands |
list of commands to that evaluate to a number |
Description:
Returns the mode of the [list of commands] when evaluated across all the turtles of the breed specified by breed
that satisfy the [condition].
Examples:
mode-of-frogs-with [color = red] [speed]
returns the mode of the speed
of all the red turtles of breed frogs.
mode-of-cars-with [brand = honda] [mileage]
returns the mode of the mileage
of all the turtles of breed car with brand honda
.
Notes:
Note: If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
Note: When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed-with
max-of-breed-with
median-of-breed-with
min-of-breed-with
mode-of-breed
mode-of-turtles-with
sdev-of-breed-with
sum-of-breed-with
variance-of-breed-with
one-of-breed
Description:
Returns a random turtle from the specified breed.
Related Commands:
count-turtles
list-of-turtles
one-of-breed-at
one-of-breed-at-with
one-of-breed-here
one-of-breed-here-with
one-of-breed-towards
one-of-breed-towards-with
one-of-breed-with
one-of-turtles
one-of-breed-at
xcor ycor
Parameters:
xcor |
Number |
x-coordinate |
ycor |
Number |
y-coordinate |
Description:
Returns a random turtle of breed breed xcor units in the x direction and ycor units in the y direction away from the caller.
Examples:
one-of-frogs-at 1 1
returns a random turtle of breed frogs
one unit to the right and one unit above the caller.
Related Commands:
one-of-breed
one-of-breed-at-with
one-of-breed-here
one-of-breed-towards
one-of-turtles-at
one-of-breed-at-with
xcor ycor [condition]
Parameters:
xcor |
Number |
number of steps in the x-direction from the caller |
ycor |
Number |
number of steps in the y-direction from the caller |
[condition] |
List of commands |
list of commands that returns true or false |
Description:
Returns a random turtle of the breed specified that satisfies [condition] that is on the patch xcor units away in the x direction and ycor units away in the y direction
Examples:
one-of-dogs-at-with 1 1 [color = brown]
returns a turtle of breed dog that is 1 unit away in the x direction, 1 unit away in the y direction and is brown
Related Commands:
one-of-breed
one-of-breed-at
one-of-breed-here-with
one-of-breed-towards-with
one-of-turtles-at-with
one-of-breed-here
Description:
Returns a random turtle of the specified breed on the caller's patch other than the caller.
Examples:
kill one-of-frogs-here
commands the caller to kill a random turtle of breed frogs
that is on the caller's patch.
Related Commands:
count-turtles-here
list-of-turtles-here
one-of-breed
one-of-breed-at
one-of-breed-here-with
one-of-breed-towards
one-of-turtles-here
one-of-breed-here-with
[list of commands]
Parameters:
[list of commands] |
List of commands |
list of commands that evaluates to either true or false |
Description:
Returns a random turtle of the breed specified that satisfies [list of commands] and is on the same patch as the caller.
Examples:
one-of-cars-here-with [color = red]
returns a turtle of breed car on the same patch as the color that is red.
Related Commands:
one-of-breed
one-of-breed-at-with
one-of-breed-here
one-of-breed-towards-with
one-of-turtles-here-with
one-of-breed-towards
angle distance
Parameters:
angle |
Number |
|
distance |
Number |
|
Description:
Returns a random turtle of the specified breed at the patch angle away at angle distance from the caller.
Examples:
one-of-frogs-towards 0 1
returns a random turtle of breed frogs
one unit directly in front of the caller.
Related Commands:
one-of-breed
one-of-breed-at
one-of-breed-here
one-of-breed-towards-with
one-of-turtles-towards-with
one-of-breed-towards-with
angle distance [condition]
Parameters:
angle |
Number |
angle from caller |
distance |
Number |
distance from caller |
[condition] |
List of turtle commands |
list of commands that returns true or false |
Description:
Returns a random turtle of the breed specified that is at a distance distance and an angle angle from the caller that satisfies [condition]
Examples:
one-of-mice-towards-with 180 1 [color = blue]
returns a random turtle of breed mice and color blue that is one space behind the caller
Related Commands:
one-of-breed
one-of-breed-at-with
one-of-breed-here-with
one-of-breed-towards
one-of-turtles-towards-with
one-of-breed-with
[condition]
Parameters:
[condition] |
List of commands |
list of commands that evaluates to either true or false |
Description:
Returns a random turtle that satisfies [condition].
Examples:
one-of-frogs-with [color = red]
returns a random turtle that is red and of breed frogs
Related Commands:
one-of-breed
one-of-turtles-with
sdev-of-breed
[list of commands]
Parameters:
[list of commands] |
List of commands |
|
Description:
Returns the standard deviation of the [list of commands] when evaluated across all the turtles of breed frogs.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
max-of-breed
median-of-breed
min-of-breed
mode-of-breed
sdev-of-breed-with
sdev-of-turtles
sum-of-breed
variance-of-breed
sdev-of-breed-with
[first list of commands] [second list of commands]
Parameters:
[first list of commands] |
List of commands |
|
[second list of commands] |
List of commands |
|
Description:
Returns the standard deviation of the [second list of commands] when evaluated across all the turtles of breed frogs that satisfy the conditions (must return a boolean of true or false) specified by the [first list of commands].
Examples:
sdev-of-frogs-with [color = red] [speed]
returns the standard deviation of the speed of all the red turtles of breed frogs.
Notes:
If [second list of commands] contains no numbers, an error occurs. If some of the [second list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
max-of-breed-with
median-of-breed-with
min-of-breed-with
mode-of-breed-with
sdev-of-breed
sdev-of-turtles-with
sum-of-breed-with
variance-of-breed-with
setbreed
breedname
Parameters:
Description:
Sets the turtle's breed to breedname.
Examples:
setbreed frogs
sets the turtle's breed to frogs
.
Related Commands:
breed
setbreed-at
setbreed-of
setbreed-towards
setbreed-at
xcor ycor breedname
Parameters:
xcor |
Number |
x offset |
ycor |
Number |
y offset |
breedname |
Breed |
|
Description:
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.
Examples:
setbreed-at 1 1 fish
sets the breed of the turtle one unit to the right and one unit above the caller to fish
.
Related Commands:
breed-at
setbreed
setbreed-of
setbreed-towards
setbreed-of
number breedname
Parameters:
number |
Number |
|
breedname |
Breed |
|
Description:
Sets the breed of the turtle with who number number to the breed breedname.
Examples:
setbreed-of 2 fish
sets the breed of the turtle with who number 2
to fish
.
Related Commands:
breed-of
setbreed
setbreed-at
setbreed-towards
setbreed-towards
angle distance breedname
Parameters:
angle |
Number |
|
distance |
Number |
|
breedname |
Breed |
|
Description:
Sets the breed of the turtle angle away in the direction arg2
to breedname.
Examples:
setbreed towards 0 1 fish
sets the breed of the turtle one unit directly in front of the caller to fish
.
Related Commands:
breed-towards
setbreed
setbreed-at
setbreed-of
sum-of-breed
[list-of-commands]
Parameters:
[list-of-commands] |
List of commands |
list of commands that return a number |
Description:
Reports the sum of [list-of-commands] for all the turtles of the breed specified.
Examples:
sum-of-frogs [weight]
returns the sum of all the frogs' weights.
sum-of-cars [speed]
returns the sum of all the cars' weights.
Notes:
When a turtle calls the command, it is not included as part of the calculation.
Related Commands:
average-of-breed
max-of-breed
median-of-breed
min-of-breed
mode-of-breed
sdev-of-breed
sum-of-breed-with
sum-of-turtles
variance-of-breed
sum-of-breed-with
[condition] [list-of-commands]
Parameters:
[condition] |
List of commands |
list of commands that evalutes to true or false |
[list-of-commands] |
List of commands |
list of commands that return a number |
Description:
Reports the total value of [list-of-commands] when run over the turtles of the breed specified that satisfy [condition]. If there are no turtles of the specified breedin which [list-of-commands] is true, 0
is returned.
Notes:
Note: This command can
also be executed by patches, for example within an ask-patches
statement.
Related Commands:
average-of-breed-with
max-of-breed-with
median-of-breed-with
min-of-breed-with
mode-of-breed-with
sdev-of-breed-with
sum-of-breed
sum-of-turtles-with
variance-of-breed-with
variance-of-breed
[list of commands]
Parameters:
[list of commands] |
List of turtle commands |
A list of commands for the frogs to run which returns a number |
Description:
Returns the numerical variance of the [list of commands]
when evaluated across all the turtles of breed frogs
.
Examples:
variance-of-frogs [speed]
returns the variance of the speeds of all the turtles of breed frogs.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
average-of-breed
max-of-breed
median-of-breed
min-of-breed
mode-of-breed
sdev-of-breed
sum-of-breed
variance-of-breed-with
variance-of-turtles
variance-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of turtle commands |
An expression that returns a true or false value |
[list of commands] |
List of turtle commands |
A list of commands for the turtles to run which returns a number |
Description:
Returns the numerical variance of the [list of commands] when evaluated across all the turtles of breed frogs
that satisfy the condition (must return a boolean of true or false) specified by the [condition].
Examples:
variance-of-frogs-with [color = red] [speed]
returns the variance of the speeds of all the red turtles of breed frogs.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
average-of-breed-with
max-of-breed-with
median-of-breed-with
min-of-breed-with
mode-of-breed-with
sdev-of-breed-with
sum-of-breed-with
variance-of-breed
variance-of-turtles-with
who-max-of-breed
[list of commands]
Parameters:
[list of commands] |
List of turtle commands |
A list of commands for the frogs to run which returns a number |
Description:
Returns a list of two elements: the turtle ID with the maximum value of the [list of commands] when evaluated across all the turtles of breed frogs
, and that maximum value.
Examples:
who-max-of-frogs [energy]
returns a list with the who number of the frog with the most energy and the highest energy value: [2 5]
.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
who-max-of-breed-with
who-max-of-turtles
who-min-of-breed
who-max-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of turtle commands |
An expression that returns a true or false value |
[list of commands] |
List of turtle commands |
A list of commands for the turtles to run which returns a number |
Description:
Returns a list of the turtle with the maximum value of [list of commands] when evaluated across all the turtles of breed frogs
that satisfy the condition (must return a boolean of true or false) specified by the [condition]., and the maximum value.
Examples:
who-max-of-frogs-with [color = red] [energy]
returns a list with the who number of the red frog with the most energy and the highest energy value: [2 5]
.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
If no turtles satisfy [condition], who-max-of-frogs-with
returns [nobody minnum]
.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
who-max-of-breed
who-max-of-turtles-with
who-min-of-breed-with
who-min-of-breed
[list of commands]
Parameters:
[list of commands] |
List of turtle commands |
A list of commands for the turtles to run which returns a number |
Description:
Returns a list of two elements: the turtle ID with the minimum value of the [list of commands] when evaluated across all the turtles of breed frogs
, and that minimum value
Examples:
who-min-of-frogs [energy]
returns a list with the who number of the frog with the least energy and the smallest energy value: [34 0.4]
.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
who-max-of-breed
who-min-of-breed-with
who-min-of-turtles
who-min-of-breed-with
[condition] [list of commands]
Parameters:
[condition] |
List of turtle commands |
An expression that returns a true or false value |
[list of commands] |
List of turtle commands |
A list of commands for the turtles to run which returns a number |
Description:
Returns a list of the turtle with the minimum value of [list of commands] when evaluated across all the turtles of breed frogs
that satisfy the condition (must return a boolean of true or false) specified by the [condition]., and the minimum value.
Examples:
who-min-of-frogs-with [color = red] [energy]
returns a list with the who number of the red frog with the least energy and the smallest energy value: [34 0.4]
.
Notes:
If [list of commands] contains no numbers, an error occurs. If some of the [list of commands], when evaluated, are not numbers, those values are ignored.
If no turtles satisfy [condition], who-min-of-frogs-with
returns [nobody maxnum]
.
When a turtle calls the command, it, itself, is not included as part of the calculation.
Related Commands:
who-max-of-breed-with
who-min-of-breed