Command List

These commands have been introduced since the previous version of StarLogo.

Turtle, Observer, Patch

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


Turtle, Patch

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.


Turtle, Observer, Patch

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.


Turtle, Observer, Patch

count-turtles-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 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-turtles-at-with 1 1 [color = red] > 1
[fd 1]

will have all of the turtles move forward who have more than one red turtle 1 unit away in the x-direction and 1 unit away in the y-direction


Turtle, Patch

count-turtles-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 on the caller's patch that meets the condition specified in [condition].

Examples:
if count-turtles-here-with [color = red] > 1
[fd 1]

This will cause all of the turtles on a patch with more than one red turtle on it to move forward one.


Turtle, Observer, Patch

count-turtles-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 that are distance units away at an angle of angle from the caller, that also satisfy [condition].

Examples:
if count-turtles-towards 0 1 [color = blue] > 1
[fd 1]

will have all of the turtles with more than one blue turtle directly in front of them move forwards one space.


Observer

export-picture-interface

Description:
Brings up the export picture dialog and saves the interface to disk as a PNG

Related Commands:
export-picture-interface-name
Observer

export-picture-interface-name name

Parameters:
name String name of the file

Description:
export-picture-interface-name name exports the interface as a PNG using the file name specified

Related Commands:
export-picture-interface
Observer

export-picture-patches

Description:
Brings up the export picture dialog and saves the patches to disk as a PNG

Related Commands:
export-picture-patches-name
Observer

export-picture-patches-name name

Parameters:
name String name of the file

Description:
Saves the patches to disk as a PNG with the filename name

Related Commands:
export-picture-patches
Observer

export-picture-turtles-and-patches

Description:
Brings up the export picture dialog and saves the turtles and patches to disk as a PNG

Related Commands:
export-picture-turtles-and-patches-name
Observer

export-picture-turtles-and-patches-name name

Parameters:
name String name of the file

Description:
Saves the patches and turtles to disk as a PNG with the filename name

Related Commands:
export-picture-turtles-and-patches
Turtle, Observer, Patch

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
Turtle, Patch

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
Turtle, Observer, Patch

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
Turtle, Observer, Patch

list-of-turtles-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 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_turtles list-of-turtles-at-with 1 1 [color = blue]
will set the variable blue_turtles to a list of the who numbers of all of the blue turtles one unit away in the x-direction and one unit away in the y-direction from the caller.

Related Commands:
list-of-breed-at list-of-breed-at-with list-of-turtles-at list-of-turtles-here-with list-of-turtles-towards-with
Turtle, Patch

list-of-turtles-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 on the caller's patch that meet the condition specified in [condition].

Examples:
set blue_turtles list-of-turtles-here-with [color = blue]
will set the variable blue_turtles to a list of all of the blue turtles' who numbers that are the same patch as the caller.

Related Commands:
list-of-breed-here-with list-of-turtles-at-with list-of-turtles-towards-with
Turtle, Observer, Patch

list-of-turtles-towards-with angle distance [condition]

Parameters:
angle Number angle from caller
distance Number distance from caller
[condition] Number

Description:
Returns a list of all of the turtles distance units away at an angle angle from the caller who also satisfy [condition].

Examples:
set red_turtles list-of-turtles-towards-with 0 1 [color = red]
will set the variable red_turtles to a list of the who numbers of all of the red turtles one unit away and directly in front of the caller.

Related Commands:
list-of-breed-towards-with list-of-turtles-at-with list-of-turtles-here-with list-of-turtles-towards
Turtle, Observer, Patch

one-of-turtles-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 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-turtles-at-with 1 1 [color = red] returns a red turtle that is one unit away in the x direction and 1 unit away in the y diretion

Related Commands:
one-of-breed-at-with one-of-turtles-at one-of-turtles-here-with one-of-turtles-towards-with
Turtle, Patch

one-of-turtles-here-with [condition]

Parameters:
[condition] List of turtle commands the condition that the turtle to be returned must meet

Description:
Returns a random turtle on the caller's patch that meets [condition]. The returned turtle is different than the caller.

Related Commands:
one-of-breed-here-with one-of-turtles-at-with one-of-turtles-here one-of-turtles-towards-with
Turtle, Observer, Patch

one-of-turtles-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 that is distance distance away at an angle angle that satisfies [condition].

Examples:
one-of-turtles-towards-with 0 1 [color = red] returns a red turtle that is 1 space away and directly in front of the caller.

Related Commands:
one-of-breed-towards one-of-breed-towards-with one-of-turtles-at-with one-of-turtles-here-with one-of-turtles-towards
Turtle

pc-ahead-one-patch

Description:
Returns the color of the patch one patch ahead. This is equivalent to pc-at round dx round dy

Examples:
pc-ahead-one-patch will return the color of the next patch in front of the turtle

Notes:
The patch returned may or may not be the same as pc-ahead. In this version the patch returned is never the same as the patch that the caller is on.

Related Commands:
patchcolor pc-ahead
Turtle, Observer, Patch

sum-of-list list

Parameters:
list List List of numbers

Description:
Returns the sum of the numbers in the list.

Examples:
sum-of-list [1 2 -3 4.5 5] returns 9.5.

Notes:
Note: If list contains no numbers, an error occurs. If some of the list, when evaluated, are not numbers, those values are ignored.

Related Commands:
average-of-list max-of-list median-of-list min-of-list mode-of-list sdev-of-list sort-num-list variance-of-list