SLogo Extended Commands

Drawing Operations and Turtle Commands

Command

Description

RANDOM max

returns a random non-negative integer less than max

SETHEADING degreees
SETH degrees

sets the turtle's heading to degrees

SETBACKGROUND color_number
SETBG color_number

sets the background color of the screen to that represented by color_number.

SETPENCOLOR color_number
SETPC color_number

sets the color of the turtle's pen to that represented by color_number

SETPENSIZE thickness
SETPS thickness

sets the size of the turtle's pen to thickness

SETSHAPE shape_number
SETSH shape_number

sets the shape of the turtle to that represented by shape_number

SETPALETTE color_number r g b

sets the actual color corresponding to a given number. color_number must be an integer greater than or equal to 8. (Logo tries to keep the first 8 colors constant.) The next three nonnegative integers less than 256 specify the amount of red, green, and blue in the desired color

SHAPE

returns the number of the turtle's current shape. If more than one turtle is active, return that of the first active turtle. To get the value of a specific turtle, use the command ASK.

BACKGROUND
BG

returns the number of the background color

PENCOLOR
PC

returns the number of the turtle's pen color. If more than one turtle is active, return that of the first active turtle. To get the value of a specific turtle, use the command ASK.

PENSIZE
PS

returns the size of the turtle's pen. If more than one turtle is active, return that of the first active turtle. To get the value of a specific turtle, use the command ASK.

TELL turtle(s)

sets the turtle(s) that will follow commands hereafter.

WRAP

tells the turtle to enter wrap mode: From now on, if the turtle is asked to move past the boundary of the graphics window, it will "wrap around" and reappear at the opposite edge of the window. The top edge wraps to the bottom edge, while the left edge wraps to the right edge. This is the turtle's initial mode.

WINDOW

tells the turtle to enter window mode: From now on, if the turtle is asked to move past the boundary of the graphics window, it will move off screen. The visible graphics window is considered as just part of an infinite graphics plane; the turtle can be anywhere on the plane.

FENCE

tells the turtle to enter fence mode: From now on, if the turtle is asked to move past the boundary of the graphics window, it will move as far as it can and then stop at the edge with an "out of bounds" error message.


Control Structures and Procedures

Command

Description

IFELSE varOrCommand 
[ instructionlist1 ]
[ instructionlist2 ] 

if varOrCommand is not 0, run instructionlist1, else run instructionlist2

ASK turtle(s) [
instructionlist
]

temporarily address turtle(s), giving them the instructions in instructionlist. This does not change the list of turtles which was set by the last tell command


Boolean Operations

Command

Description

AND test1 test2 

returns 1 if test1 and test2 are 1, otherwise 0

OR test1 test2

returns 1 if test1 or test2 are 1, otherwise 1

NOT test1

returns 1 if test1 is 0, otherwise 1

Comments?