LOGO Primitives

 

Command

Short Form

Example

Description

 

STAMP

STAMP

STAMP

STAMP “draws” the shape of the active turtle(s) in the Graphics window with the turtle at the center of the image at its current location. (Move the current turtle to see the stamped image.)

STAMPOVAL

STAMPOVAL xradius yradius 

STAMPOVAL 100 150

STAMPOVAL draws an oval around the current turtle(s). It takes two numbers as inputs. The first input is the oval's radius in the horizontal direction; the second input is its radius in the vertical direction. STAMPOVAL draws a circle if the two inputs are equal.

STAMPRECT

STAMPRECT width height 

STAMPRECT 100 150 

STAMPRECT draws a rectangle with a width in turtle steps defined by its first input and a height defined by its second input. The rectangle is drawn with the current turtle position in the lower left corner. STAMPRECT draws a square if the two inputs are equal.

LOCKSHAPE

LOCKSHAPE

LOCKSHAPE

LOCKSHAPE prevents the turtle's shape from rotating when the turtle turns. This can be convenient when you want the shape to appear in its original orientation, regardless of how you turn the turtle. The command HEADING always reports the true heading of the turtle. Use UNLOCKSHAPE to restore the shape's visual orientation to match its heading.

UNLOCKSHAPE

UNLOCKSHAPE

UNLOCKSHAPE

UNLOCKSHAPE restores the normal rotation of the turtle, canceling the effects of LOCKSHAPE. The turtle immediately returns to the orientation that most accurately represents its true heading.

SAVESHAPE

SAVESHAPE filename

SAVESHAPE “arrow

SAVESHAPE saves the shape of the first active turtle directly on the disk. The shape is never saved in a rotated state. SAVESHAPE saves graphics images in the format specified in the built-in variable PICTURE.FORMAT. You do not need to include the extension to save the file in the default format. Add the extension BMP or JPG (also PICT on the Macintosh) to save the file in a different graphics format. These images can be viewed with LOADSNAP or LOADPIC.

LOADSHAPE

LOADSHAPE filename

LOADSHAPE “arrow

LOADSHAPE loads the specified file from the disk and sets the shape of all active turtles to that image. Note that the file still exists on the disk; only a copy of it has been transferred to the workspace. Turtle shapes are normally black-and-white bitmaps with a size of 31x31 dots. If the loaded bitmap is bigger or smaller, it is scaled to a size of up to 31x31 dots and converted to black-and-white. White areas of the bitmap are made transparent, while all other colors make up the turtle shape.

SETSHAPE

SETSHAPE shapename

SETSHAPE "SAILBOAT

SETSHAPE redefines the shape of the active turtle(s). Its input is the name of the bitmap shape to assign to the turtle. This shape should be 31 by 31 pixels square and black-and-white. Logo treats all black pixels as shape pixels, while all pixels of colors other than black are ignored. If a bitmap of a different size is used, it is scaled to fit the 31 by 31 pixel turtle shape.  If SETSHAPE is used with no arguments and enclosed in parentheses, the original turtle shape is restored for all active turtle(s).

 

WAIT

WAIT number

WAIT 500

WAIT inserts a pause before the next instruction is run. The length of the pause is the input to WAIT times 1/1000 of a second (milliseconds). So WAIT 1000 is a one second delay.

FOR

 

FOR "I 1 4 [PRINT :I]

 

(FOR "I 1 4 [PRINT :I] 2)

FOR allows you to execute a list of Logo commands a specified number of times. Inputs to FOR are a control variable, a beginning value, an ending value, and a list of Logo commands to be executed. FOR assigns the beginning value to the variable, executes the instruction list, increments the variable by one, checks to see if the variable is equal to or greater than the ending value, and then repeats the process until the value of the variable equals or exceeds the ending value.  The variable increment step can be changed to a number other than one by listing the increment as a fifth input to FOR and enclosing FOR and all its inputs in parentheses.

 

WHILE

 

MAKE "X 1 
WHILE [:X < 5] [PRINT :X MAKE "X :X + 1]

WHILE evaluates its first input and runs the Logo command(s) in its second input if the value of the first input is TRUE. WHILE will continue this process until the value of the first input is FALSE.