_____________________________________________________________
alive?
alive?-of ID-number
alive? reports true if the turtle is alive. alive?-of reports true if turtle with the
given ID-number is alive.
_____________________________________________________________
bk number
Moves turtles backward by number steps.
_____________________________________________________________
breed
breed-of id-number
breed-at xcor ycor img src="../images/observer.gif">
Reports the breed of the turtle.
_____________________________________________________________
die
Tells turtles to die.
Example:
if pc = red [die]
(All turtles on red patches die.)
_____________________________________________________________
distance x-coordinate y-coordinate
distance-nowrap x-coordinate y-coordinate
Reports the distance to the point (x-coordinate, y-coordinate)
With distance, turtles and patches use the "wrapped distance" (around the edges of the
screen) if that distance is shorter than the "onscreen distance." With distance-nowrap,
turtles and patches always use the onscreen distance.
Example:
if (distance 0 0) > 10 [setc green]
(All turtles more than 10 units from the center of the screen turn green.)
_____________________________________________________________
dx
dy
dx reports the x-increment if the turtle were to take one step forward. dy reports
the y-increment if the turtle were to take one step forward. These primitives are useful
for "testing" the patch ahead of the turtle before moving.
_____________________________________________________________
forward, fd number
Moves turtles forward by number steps.
_____________________________________________________________
hatch procedure-list
Each turtle creates a new turtle, identical to itself, and tells the new turtle to
execute procedure-list.
Example:
hatch [lt 45] hatch [rt 45]
(Each turtle creates two new turtles, one angled to the left, one angled to the right.)
_____________________________________________________________
heading
heading-of ID-number
heading reports the heading of the turtle. Heading 0 is due north, 90 is east, as so on.
heading-of reports the heading of the turtle with the given ID-number.
_____________________________________________________________
home
Moves the turtle to the middle of the screen, at coordinates (0, 0).
_____________________________________________________________
hideturtle, ht
Hides the turtle, so that it is invisible.
_____________________________________________________________
jump number
Moves turtles forward by number units in one "big step" (in one unit of time).
This command is useful for synchronizing turtle movements. The command fd 15 takes
15 times longer to execute than fd 1, but jump 15 executes in the same time
as jump 1 or fd 1.
_____________________________________________________________
left, lt number
Turns turtles left by number degrees.
_____________________________________________________________
patchcolor, pc
pc-at dx dy
pc reports the color number of a patch.
pc-at reports the color of the patch (dx, dy) units away.
Example:
if pc = white [fd 20]
(All turtles on top of white patches move forward 20 steps.)
if pc = red [setpc blue]
(All red patches turn blue.)
_____________________________________________________________
pendown, pd
Puts down the turtle's pen, so that the turtle draws (leaves a trail) when it moves.
The turtle draws by changing the color of the patches underneath it to its own color.
To change the color of the turtlešs pen (and the color of the turtle itself), use setc.
_____________________________________________________________
pen-down?
Reports if the pen is down.
_____________________________________________________________
psetbreed
psetbreed-at
psetbreed-of
_____________________________________________________________
pstamp color
pstamp-at dx dy color
pstamp sets the color of all turtles in the patch to color.
pstamp-at is used by a patch to set the color of turtles in the patch (dx, dy)
units away.
_____________________________________________________________
penup, pu
Lifts up the turtle's pen, so that the turtle doesn't draw when it moves. To put down
the turtle's pen, use pd (for pen down).
_____________________________________________________________
psetshape number
Patch sets the shape of one of the turtles on top of it to number.
_____________________________________________________________
psetshape-of turtle# number
Patch sets the shape of turtle turtle# to number.
_____________________________________________________________
psetshape-at dx dy number
Patch sets the shape of all turtles on the patch dx dy away from it to number.
_____________________________________________________________
right rt number
Turns turtles right by number degrees.
_____________________________________________________________
scale-color color variable min max
scale-pc color variable min max
(scale patch color)
Sets the color (for each turtle for scale-color, for each patch for scale-pc)
to a shade of color proportional to its value of variable. The larger the
variable, the lighter the shade of color. If variable is greater than max,
color is close to white. If variable is less than min, the color is black.
Examples:
scale-color red age 0 50
(Colors each turtle a shade of red proportional to its value for the variable age.)
scale-color green chemical 0 50
(Colors each patch a shade of green proportional to its value for the variable chemical.)
_____________________________________________________________
setcolor, setc color
setc-of ID-number color
setc-at dx dy color
setc sets turtle's color to the given color. See section 3 for discussion
of StarLogo colors.
setc-of sets the color of the turtle with the given ID-number.
setc-at is used by a turtle to set the color of turtles in the patch (dx, dy)
units away.
Example:
setc red
(Each turtle turns red.)
_____________________________________________________________
setheading, seth number
(set heading)
Sets the heading of turtles to number. Heading 0 is due north, 90 is east, and so on.
_____________________________________________________________
seth-of turtle# heading
Turtle sets the heading of turtle turtle#.
_____________________________________________________________
setpatchcolor, setpc color
setpc-at dx dy color
setpc sets patch's color to the given color. See section 3 for discussion
of StarLogo colors.
setpc-at is used by a patch to set the color of the patch (dx, dy) units away.
Example:
setpc green
(Each patch turns green.)
_____________________________________________________________
setxcor, setx number
Sets the x-coordinate of turtles to number.
_____________________________________________________________
setxy number1 number2
Sets the x-coordinate of turtles to number1 and the y-coordinate of turtles to
number2.
Example:
setxy 0 0
(All turtles move to the center of the screen.)
_____________________________________________________________
setycor, sety number
Sets the y-coordinate of turtles to number.
_____________________________________________________________
setxy-of turtle# xcor ycor
Turtle sets the xcor and ycor of turtle turtle#.
_____________________________________________________________
setx-of turtle# xcor
Turtle sets the xcor of turtle turtle#.
_____________________________________________________________
sety-of turtle# ycor
Turtle sets the ycor of turtle turtle#.
_____________________________________________________________
shape
shape-at
shape-of
Reports the shape of the turtle.
_____________________________________________________________
showturtle, st
Makes the turtle visible. (Turtle can be hidden with the command ht.)
_____________________________________________________________
sprout list
Patch creates a turtle which runs list.
_____________________________________________________________
stamp color
stamp-at dx dy color
stamp sets the color of the patch under the turtle to the given color.
See section 3 for discussion of StarLogo colors.
stamp-at is used by a turtle to set the color of the patch (dx, dy) units away.
_____________________________________________________________
towards x-coordinate y-coordinate
towards-nowrap x-coordinate y-coordinate
Reports the direction from the turtle towards the point (x-coordinate, y-coordinate).
If the "wrapped distance" (around the edges of the screen) is shorter than the "onscreen
distance," towards will report the direction of the wrapped path, while
towards-nowrap will report the direction of the onscreen path.
_____________________________________________________________
one-of-turtles-at , old way: turtle-at x-offset y-offset
Reports the ID-number of another turtle in the patch that is x-offset away in the
x-direction and y-offset away in the y-direction. If there are several turtles in
the patch, an arbitrary (other) turtle is picked.
If used by a patch, and there are no turtles in the indicated patch, reports -1. If used by
a turtle, and there are no other turtles in the indicated patch, reports -1.
_____________________________________________________________
one-of-turtles-here, old way: turtle-here
Reports the ID-number of another turtle in the same patch. If there are several turtles in
the patch, an arbitrary (other) turtle is picked.
If used by a patch, and there are no turtles in the patch, reports -1. If used by a turtle,
and there are no other turtles in the patch, reports -1.
_____________________________________________________________
count-turtles-at, old way: turtles-at x-offset y-offset
Reports the number of turtles in the patch that is x-offset away in the x-direction
and y-offset away in the y-direction.
_____________________________________________________________
count-turtles-here, old way: turtles-here
Reports the number of turtles in the patch.
_____________________________________________________________
who
Reports the ID-number of the turtle.
Example:
if who < 50 [setc blue]
(Makes 50 of the turtles blue.)
_____________________________________________________________
xcor
xcor-of ID-number
xcor reports the x-coordinate of a turtle or a patch.
xcor-of reports the x-coordinate of the turtle with the given ID-number.
Example:
sety xcor
(Sets turtles' y-coordinate to equal x-coordinate, so that all turtles move to the line y=x.)
_____________________________________________________________
ycor
ycor-of ID-number
ycor reports the y-coordinate of a turtle or a patch.
ycor-of reports the y-coordinate of the turtle with the given ID-number.
Example:
setpc ycor
(Displays the StarLogo color table as horizontal bands.)
=============================================================