Turtle Drawing

Move turtles around, and make them draw.

Turtle movement commands control the direction of the turtle movement. Drawing commands draw arcs, text, or fill areas.

All commands that accept a coordinate pair accept one of the following inputs:

  • No inputs: use the turtle's coordinates.
  • One input: if the input is a number, use that number for both the X and Y coordinates; if it is a list, it is a two-element list with the X and Y coordinates.
  • Two inputs: use the two numbers as X and Y coordinates.

Examples:

; draw a dot at the current coordinates
(DOT)
; draw a dot at 100, 100
DOT 100
; draw a dot at 50, 90
DOT [50 90]
; draw a dot at 111,222
(DOT 111 222)

Note that the background color or image is not part of a drawing, and its color cannot be examined.

Please also not that most commands are also valid for controls as well; controls act exactly like turtles, they just cannot draw because they do not have a pen. Therefore, we often use the word “widget”, which addresses turtles as well as controls.

ARC

Draws an arc.

Syntax

ARC degrees radius
(ARC degrees radius TRUE)

Description

ARC draws an arc, which is part of a circle. The center is the position of the turtle. The arc is drawn with the given radius. It starts at the current heading of the turtle and continues clockwise for the given number of degrees if degrees is positive, or counter-clockwise if degrees is negative. The turtle does not move.

If you use TRUE as the third input to ARC, Logo closes the arc by drawing a line from endpoint to endpoint.

Example

REPEAT 12 [ARC 25 100 RT 30]

BACK (BK)

Moves a turtle backwards.

Syntax

BACK number

Description

BACK moves the turtle in the opposite direction of its HEADING by the distance specified by its input. See also FORWARD.

The BACK command works slightly differently for a Blue-Bot robot. Blue-Bot moves in fixed-size units. A value of 1 does not mean a single pixel as the screen turtle, but one Blue-Bot movement unit, which is about 6 inches (15 cm). If you, for example, use the command BACK 2, Blue-Bot will move backwards one unit, stop briefly, and then moves backwards a second unit. The same applies to a Pro-Bot, which moves about 10 inches (25 cm) per unit.

For screen widgets, BACK multiplies its input with the turtle's STEPSIZE property. Setting the STEPSIZE property to, for example 15 (for a Blue-Bot turtle on screen), a turtle would move 15 pixels for each BACK unit.

Example

BACK 50
BK 50

DISTANCE

Reports the distance between the turtle and a location.

Syntax

DISTANCE [x y]

Description

DISTANCE reports a number which is the distance in turtle steps from the first active turtle to the specified point. DISTANCE can be used to test how close a turtle is to another turtle, the mouse, or a target.

Example

ASK 1 [SETPOS [50 50] SHOWTURTLE]
ASK 2 [SETPOS [0 50] SHOWTURTLE]
DISTANCE ASK 1 [POS]
Result: 70.71
DISTANCE ASK 2 [POS]
Result: 50

DOT

Draws a dot.

Syntax

DOT [xcoordinate ycoordinate]
(DOT)

Description

DOT draws a dot at the specified location. When DOT has no input and is enclosed in parentheses, it draws a pixel at the location of the turtle. DOT draws a dot for each active turtle. If coordinates are given, the coordinates are relative to the origin and scale of each active turtle. The dot is as wide as the pen width set with SETWIDTH.

Example

TO RANDOM.DOTS :COUNT :AREA
	REPEAT :COUNT [DOT SENTENCE RANDOM :AREA RANDOM :AREA]
END

SETPC "RED
RANDOM.DOTS 300 50

DOT? (DOTP)

Tests whether a pixel is present at the given location.

Syntax

DOT?
(DOT? [xcoordinate ycoordinate])

Description

DOT? reports TRUE if the pixel identified by its argument has a color that is not fully transparent. The coordinates are the coordinates of the first active turtle. If DOT is called with a coordinate pair as input (enclosed in parentheses), it uses the given coordinates relative to the origin and scale of the first active turtle.

Note that the background color or image is not part of a drawing, and its color at the given coordinates cannot be examined. If nothing has been drawn at the given location, the color that DOTCOLOR reports would be [0 0 0 0], which is invisible black.

Example

DOT [50 50]
(DOT? [50 50])
Result: TRUE

DOTCOLOR

Reports the color of a pixel.

Syntax

DOTCOLOR [xcoordinate ycoordinate]
(DOTCOLOR)

Description

DOTCOLOR reports the color of the pixel identified by its argument. The color is reported as a list of Red, Green, Blue and Alpha values. When DOTCOLOR has no input and is enclosed in parentheses, it reports the color of the pixel under the first active turtle. If coordinates are used as input, the coordinates are screen coordinates, with [0 0] at the center.

If the alpha value of the color is 0, the dot is invisible, and the background is visible at that position. Note that the background color or image is not part of a drawing, and its color at the given coordinates cannot be examined. Hence, DOTCOLOR reports the color of a location that has not been drawn onto as [0 0 0 0], which is a fully transparent (invisible) black.

FILL

Fills an area.

Syntax

FILL
(FILL tolerance)

Description

FILL fills an area of the Graphics panel with the current turtle color; it does not use the current pattern set with the SETPATTERN command. FILL picks up the color at the current turtle position and stops at a closed border of any other color. If the turtle's pen state is not PENDOWN, FILL does nothing.

Logo supports transparent colors. To make Logo fill transparent colors, FILL accepts a second, optional input. This is a tolerance value between 0 and 1 that affects the way Logo fills transparent colors. A value of 0 makes FILL stop at any color regardless of its transparency, while a value of 1 fills any color, resulting in a complete fill of the entire area. As a default value, Logo uses the value 0.5, which fills all colors that are more than half-transparent.

A clean Graphics panel does not contain any color at all (it is actually pre-filled with a totally transparent black color). When drawing, Logo uses anti-aliasing, which results in smoother lines. Logo does this by adding semi-transparent pixels to the line to create the impression of a smooth line. By using a tolerance value of 0.5, FILL fills these semi-transparent values up to the “real” line. Try, for example, to fill a circle with a tolerance value of 0 to see slight remains of white-looking pixels that Logo refused to fill.

If you experience color bleeding (Logo fills too much), try to use a line width other than 1 (see SETWIDTH) to help FILL find the borders to stop at.

Example

DRAW
STAMPOVAL 100 100
SETPC "SADDLEBROWN
FILL
SETPC "BLACK
STAMPOVAL 80 80
SETPC 41
FILL

FONT

Reports the current font of the first active turtle.

Syntax

FONT

Description

The FONT command reports the current font of the first active turtle as a three element list consisting of the font name, the font size, and the font attributes.

See also GOOGLEFONTS, LOADFONT, SETFONT and FONTS.

Example

FONT
Result: [Verdana 9 0]

FONTS

Reports a list of all loaded and available fonts.

Syntax

FONTS

Description

The FONTS command reports a list of all available fonts that can be used to print text in the Graphics panel using the TURTLETEXT command.

Use the LOADFONT command to download a font from Google Fonts.

See also FONT, SETFONT, GOOGLEFONTS and TURTLETEXT.

FONTS
Result: [TIMES HELVETICA COURIER SERIF SANS_SERIF MONOSPACE]

FORWARD (FD)

Moves a turtle forward.

Syntax

FORWARD number

Description

FORWARD moves the turtle in the direction of its HEADING by the distance specified by its input. See also BACK.

The FORWARD command works slightly differently for a Blue-Bot robot. Blue-Bot moves in fixed-size units. A value of 1 does not mean a single pixel as the screen turtle, but one Blue-Bot movement unit, which is about 6 inches (15 cm). If you, for example, use the command FORWARD 2, Blue-Bot will move forward one unit, stop briefly, and then moves forward a second unit. The same applies to a Pro-Bot, which moves about 10 inches (25 cm) per unit.

For screen widgets, FORWARD multiplies its input with the turtle's STEPSIZE property. Setting the STEPSIZE property to, for example 15 (for a Blue-Bot turtle on screen), a turtle would move 15 pixels for each FORWARD unit.

Example

FORWARD 50
FD 50

GETX (XCOR)

Reports the X coordinate of a turtle.

Syntax

GETX

Description

GETX outputs the X coordinate of the turtle's position in the Graphics canvas. See also GETY, GETXY, SETX, SETY, and SETXY.

Example

GETX
Result: 0

GETXY (POS)

Reports the coordinates of a turtle.

Syntax

GETXY

Description

GETXY reports a list consisting of the x and y coordinates of the turtle. GETXY is equivalent to POS. See also GETX, GETY, SETX, SETY, and SETXY.

Example

GETXY
Result: [0 0]

GETY (YCOR)

Reports the Y coordinate of a turtle.

Syntax

GETY

Description

GETY outputs the Y coordinate of the turtle's position in the Graphics canvas. See also GETX, GETXY, SETX, SETY, and SETXY.

Example

GETY
Result: 0

GOOGLEFONTS

Reports a list of all available Google fonts.

Syntax

GOOGLEFONTS
(GOOGLEFONTS category)

Description

GOOGLEFONTS reports a list of all available Google fonts (see https://fonts.google.com). This is a list of almost 1000 fonts. Font names are Logo names, which means that the Google font name is converted to upper case, and spaces are replaced with underlines. The Google font “Oleo Script”, for example, is available to Logo as OLEO_SCRIPT.

An optional second input limits the output to a certain font category:

SERIF - serif fonts, e.g. Times
SANSSERIF - serifless fonts, e.g. Helvetica
MONOSPACE - typewriter-like fonts, e.g. Courier
HANDWRITING - fonts that look like written , e.g. Kalam or Sacramento
DISPLAY - fancy fonts that can be used on screen, but not really for printed matter

Note that most of these fonts do not support the full Unicode character set. GOOGLEFONTS only ouputs fonts that at least cover a suitable range of basic characters (the Latin character set or parts thereof).

Use LOADFONT to load a Google font and make it available to Logo.

The FONTS command lists all fonts that are available to Logo.

See also FONT and SETFONT.

Example

GOOGLEFONTS
Result: [ABEEZEE ABEL ABHAYA_LIBRE ABRIL_FATFACE ACLONICA
...
ZILLA_SLAB_HIGHLIGHT]

HEADING

Reports the heading of a turtle.

Syntax

HEADING

Description

HEADING reports the turtle's heading, a number between 0 and 360, representing the turtle's angle from the straight up position. Straight up is 0, to the right is 90, down is 180, and to the left is 270.

Use SETHEADING to set the turtle's heading.

Example

TO NAUTILUS
	RT 10
	FORWARD HEADING
	BACK HEADING
	IF HEADING < 90 THEN NAUTILUS
END

NAUTILUS

HIDETURTLE (HT)

Hides a turtle.

Syntax

HIDETURTLE

Description

HIDETURTLE makes the turtle shape invisible. To make the turtle visible, use SHOWTURTLE. See also SHOWN?.

HOME

Moves the turtle back to [0 0].

Syntax

HOME

Description

HOME moves the turtle to the center of the screen and points the turtle straight up without clearing the graphics screen or altering the pen state. Typing HOME is equivalent to entering SETXY [0 0] SETHEADING 0.

Example

DRAW

TO HEART
	REPEAT 10 [FD 5 RT 18]
	REPEAT 22 [FD 3 RT 3]
	PU HOME PD
	REPEAT 10 [FD 5 LT 18]
	REPEAT 22 [FD 3 LT 3]
	HT
END

HEART

LEFT (LT)

Turns a turtle left.

Syntax

LEFT number

Description

LEFT rotates the turtle left (counterclockwise) the number of degrees specified in its input.

Note that a Blue-Bot robot turns in increments of 45 degrees, and an InO-Bot robot turns in increments of 5 degrees. Therefore, the input to LEFT must be a multiple of 45 for Blue-Bot and 5 for InO-Bot. InO-Bot only accepts input values between -180 and 180.

See also RIGHT.

Example

LEFT 45

LOADFONT

Loads a Google font or a list of Google fonts.

Syntax

LOADFONT "fontname
LOADFONT [fontname1 fontname2 ...]

Description

LOADFONT loads a font or a list of fonts from Google Fonts for subsequent use by Logo (see https://fonts.google.com). Google makes almost 1000 fonts available. Font names are Logo names, which means that the Google font name is converted to upper case, and spaces are replaced with underlines. The Google font “Oleo Script”, for example, is available to Logo as OLEO_SCRIPT. If the Google font is not available, LOADFONT reports an error.

You can also use the original Google font names, like “|Luckiest Guy|. Logo converts font names to Logo font names before using them.

Use GOOGLEFONTS to see a list of all Google fonts.

The FONTS command lists all fonts that are available to Logo.

See also FONT and SETFONT.

Example

LOADFONT "MONOTON
LOADFONT [LUCKIEST_GUY LOBSTER LOBSTER_TWO]
SETFONT "LOBSTER 48 0
TURTLETEXT [THIS IS LOBSTER]

OPACITY

Reports the opacity of the first active turtle.

Syntax

OPACITY

Description

The OPACITY command reports the opacity value of the first active turtle. This is a value between 0 (totally transparent, so it is invisible) and 1 (totally opaque). Setting a value lower than 1 make the drawing, other widgets beneath the turtle, or the background shine through. See also SETOPACITY.

Example

OPACITY
Result: 1

ORIGIN

Reports the origin of a turtle's coordinate system.

Syntax

ORIGIN

Description

The ORIGIN command reports the coordinate system origin of the first active turtle in the form of a list with two integers: the first integer is the X value and the second integer is the Y value. The coordinates reported by ORIGIN are relative to the standard turtle coordinate system, where [0 0] is the center of the canvas. See also SETORIGIN.

Example

CS
ASK 0 [SETPOS [-25 0] SETORIGIN POS]
ASK 1 [SETPOS [25 0] SETORIGIN POS]
TELL [0 1]
FD 50 RT 135 FD 36
HOME
ASK 0 [ORIGIN]
Result: [-25 0]
ASK 1 [ORIGIN]
Result: [25 0]

PANGLE

Reports the turtle's angle as a polar angle.

Syntax

PANGLE

Description

Polar coordinates describe positions on a plane in terms of the distance from the turtle's home in the center of the Graphics canvas and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o'clock.

PDIST

Reports the distance from the turtle to its home.

Syntax

PDIST

Description

PDIST reports the distance from the turtle to its home in the center of the Graphics canvas. Polar coordinates describe positions on a plane in terms of the distance from the turtle's home in the center of the Graphics canvas and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o'clock.

PEN

Reports the pen mode.

Syntax

PEN

Description

PEN reports the pen mode of the current turtle. Available modes are PENDOWN, PENUP, PENERASE, and PENREVERSE.

Example

DRAW
PEN

PENDOWN (PD)

Puts the pen down.

Syntax

PENDOWN

Description

PENDOWN puts the turtle's pen down and causes the turtle to draw a line when it moves. Used in conjunction with PENUP. DRAW puts the pen down. See also PENDOWN?, SETPEN, PENERASE, and PENREVERSE.

PENDOWN? (PENDOWNP)

Checks whether the pen is down.

Syntax

PENDOWN?

Description

PENDOWN? reports TRUE if the pen of the current turtle is in a drawing mode. Thus, it reports TRUE if the pen is set to PENDOWN, PENERASE, or PENREVERSE mode, where the turtle may affect the graphics when it moves. When the pen is set to PENUP mode, PENDOWN? reports FALSE.

Example

PENDOWN
PENDOWN?
Result: TRUE
PENUP
PENDOWN?
Result: FALSE
PENERASE
PENDOWN?
Result: FALSE

PENERASE (PE)

The pen draws with the background color.

Syntax

PENERASE

Description

PENERASE turns the turtle's pen into an eraser. When the turtle moves, it appears to erase by drawing in the current background color. To stop PENERASE, use PENDOWN, PENUP, PENERASE, or SETPEN.

PENREVERSE (PX)

The pen inverts all colors.

Syntax

PENREVERSE

Description

PENREVERSE inverts the drawing. It erases anything drawn, and draws if there is no drawing. Note hat due to anti-aliasing, some residue may be left when a drawing is erased.

Please also note thet PENREVERSWE works differently from Logo 4, where the colors were inverted.

DRAW puts the pen down. See also SETPEN, PENDOWN, PENUP, and PENERASE.

PENUP (PU)

The pen moves up.

Syntax

PENUP

Description

PENUP puts the turtle's pen up. When the turtle moves, it does not draw a line. Used in conjunction with PENDOWN. See also PENDOWN?, PENERASE, and PENREVERSE.

PHEADING

Reports the turtle's polar heading.

Syntax

PHEADING

Description

Polar coordinates describe positions on the plane in terms of the distance from the turtle's home and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading that is equivalent to 3 o'clock.

PHEADING reports the polar heading of the turtle. A heading of 0 degrees is equivalent to a Cartesian heading of 90 degrees. Set the polar heading with PSETHEADING.

See also SETP, PPOS, PANGLE, and PDIST.

Example

SETP 35 60
PSETH 180
PHEADING
Result: 180

PPOS

Reports the turtle's polar position.

Syntax

PPOS

Description

PPOS reports the turtle's polar position, a list of two numbers: the distance from home and the polar angle. Set the polar position using SETP. Polar coordinates describe positions on a plane in terms of the distance from the turtle's home in the center of the Graphics canvas and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o'clock. See also PHEADING, PANGLE, and PDIST.

PSETHEADING (PSETH)

Sets the polar heading of a turtle.

Syntax

PSETHEADING number
PSETH number

Description

Polar coordinates describe positions on the plane in terms of the distance from the turtle's home and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading that is equivalent to 3 o'clock. PSETHEADING sets the polar heading of the turtle. A polar heading of 0 degrees is equivalent to 90 degrees in the turtle's normal (Cartesian) coordinate system. PHEADING reports the polar heading. See also SETP, PPOS, PANGLE, and PDIST.

Example

SETP 35 60
PSETH 180
PHEADING
Result: 180

RIGHT (RT)

Turns a turtle right.

Syntax

RIGHT number

Description

RIGHT rotates the turtle right (clockwise) the number of degrees specified in its input.

Note that a Blue-Bot robot turns in increments of 45 degrees, and an InO-Bot robot turns in increments of 5 degrees. Therefore, the input to LEFT must be a multiple of 45 for Blue-Bot and 5 for InO-Bot. InO-Bot only accepts input values between -180 and 180.

See also LEFT.

Example

RIGHT 45

SETFONT

Sets the turtle drawing font.

Syntax

SETFONT name size attributes
(SETFONT name size)
(SETFONT name)
(SETFONT)
(SETFONT [name size attributes])
(SETFONT [name size])
(SETFONT [name])
(SETFONT [])

Description

SETFONT defines the turtle font. The first input is the font name. This font should be present in the system. If the font is not present, the operating system selects a similar font for you. The second input is the font size, given in points, while the third is a combination of the following values:

0 regular
1 bold
2 italic

SETFONT can also be called with fewer than three inputs; in that case, the parts of the font that are not supplied are left unchanged. Calling SETFONT with no inputs causes the font to be reset to the default turtle font. Also, calling SETFONT with a list of zero to three elements is possible to match the output of FONT with the input to SETFONT. See also FONT, FONTS and TURTLETEXT.

Example

SETFONT "TIMES 14 1
TT "HELLO

SETHEADING (SETH)

Sets the heading of a turtle.

Syntax

SETHEADING number

Description

SETHEADING turns the turtle to the degree position specified by its input. Positive numbers turn the turtle clockwise.

SETHEADING turns the turtle relative zero degrees and not the current heading of the turtle. SETHEADING 0 always points the turtle straight up, regardless of the direction in which it is pointing.

To output the turtle's heading, use HEADING.

Please note that changing the heading does not change the physical size, although the bounding box increases and decreases according to the angle. If used inside a grid, the size of grid cell does not adjust to the rotated widget.

Example

TO NAUTILUS
	RT 10
	FORWARD HEADING
	BACK HEADING
	IF HEADING < 90 THEN NAUTILUS
END

NAUTILUS

SETOPACITY

Sets the opacity of all active turtles.

Syntax

SETOPACITY value

Description

The SETOPACITY command sets the opacity value of all active turtles. This is a value between 0 (totally transparent, so they are invisible) and 1 (totally opaque). Setting a value lower than 1 make the drawing, other widgets beneath the turtles, or the background shine through. See also OPACITY.

Example

SETOPACITY 0.8

SETORIGIN

Sets the coordinate system origin of the active turtles.

Syntax

SETORIGIN xy
SETORIGIN [x y]
(SETORIGIN)

Description

The SETORIGIN command allows the coordinate system origin point to be set for active turtles. Normally, the coordinate system origin (location [0 0]) is at the center of the canvas. This origin may be changed for all turtles or individually for any turtle.

The input for SETORIGIN is a list of two integers, an X value and a Y value. The coordinates are always relative to the standard turtle coordinate system, where [0 0] is the center of the canvas. If you supply a single number, it sets both the X and Y coordinates. (SETORIGIN) resets the origin to the center of the canvas.

Each turtle can have its own origin on the screen.

See also ORIGIN.

Example

ASK 1 [SETXY [25 0] SETORIGIN POS]
TELL [0 1] ST
FD 50 RT 135 FD 36
HOME

SETP

Sets the turtle's polar position.

Syntax

SETP distance angle

Description

SETP sets the turtle's polar position. It takes two inputs: a distance and a polar angle. It aims the turtle at the specified polar heading and moves it forward the specified distance. Polar coordinates describe positions on a plane in terms of the distance from the turtle's home in the center of the Graphics canvas and the angle from 0 degrees. Polar coordinates measure degrees counter-clockwise from a 0 degree heading equivalent to 3 o'clock. See also PHEADING, PANGLE, and PDIST.

SETPEN

Sets the pen characteristics.

Syntax

SETPEN [penstate pencolor]

Description

SETPEN changes the state of the turtle's pen and the pen color as specified by its input list. The first element of the list can be PENUP, PENDOWN, PENERASE, or PENREVERSE. The second element is a number from 0 to 163 (the index of a color name that the COLORS procedure returns, a color word or a list of three RGB values, which specifies the pen color. Use PEN to output the current turtle's pen state and PENCOLOR to output the current turtle's pen color. See also SETPC.

Example

SETPEN [PENDOWN RED]
FD 50

SETSHADOW

Sets the drop shadow for all active turtles.

Syntax

SETSHADOW value

Description

The SETSHADOW command sets the drop shadow for all active turtles. This is a value between 0 and 99, and describes the offset in pixels of the drop shadow. The drop shadow simulates a light source towards the upper left corner of the display. A value of 3, for example, creates a neat little shadow underneath the turtle. See also SHADOW.

Example

; set the shadow distance according to the turtle's Z-order
TELLALL 0 15
EACH [SETSHADOW GPROP WHO "Z.ORDER]

SETSPEED

Sets the speed in which turtle commands are executed.

Syntax

SETSPEED number

Description

SETSPEED determines the speed at which the turtles move on the screen when being issued a movement command. SETSPEED accepts a number from 0.1 to 1 as an input. A speed of 1 is the fastest speed and 0.1 is the slowest. When Logo starts, the turtle speed is 1. SETSPEED slows down the execution speed of any movement commend. To retrieve the current speed, see SPEED.

SETSPEED sets the value of the turtle's CRAWL property.

Example

SETSPEED 0.5
FD 100
SETSPEED 1

SETSTEPSIZE

Sets the step size of all active turtles and bitmaps.

Syntax

SETSTEPSIZE pixels

Description

SETSTEPSIZE sets the distance, in pixels, that Logo turtles and widgets move with each FORWARD or BACK command. SETSTEPSIZE sets this value for all currently active Logo turtles and widgets. By default, each Logo turtle and widget moves in steps of one pixel.

To obtain the step size for a turtle or widget see STEPSIZE.

Example

FD 10
SETSTEPSIZE 10
FD 10
SETSTEPSIZE 1
BK 110

SETTURTLESIZE (SETTSIZE,SETTS)

Sets the scaling factor of a widget.

Syntax

SETTURTLESIZE number
SETTURTLESIZE list
(SETTURTLESIZE x-scale y-scale)

Description

SETTURTLESIZE sets the scaling factor of the widget. The input number(s) must be in the range of 0.01 to 99, where 0.01 indicates an almost invisibly small widget, and 99 the largest possible widget. As the size of the turtle increases, its shape becomes more jagged. If SETTURTLESIZE is used with two inputs, or with a two-element list, the first input is the horizontal scaling factor, and the second input is the vertical scaling factor.

The command TURTLESIZE reports the size of the first widget of the TELL list.

Please note that changing the scaling factor does not change the physical size. If used inside a grid, the size of grid cell does not adjust to the scaled widget.

Example

TELL [0 1 2]
ST
EACH [PU SETX 100 * WHO SETTURTLESIZE WHO + 1]

SETWIDTH (SETW)

Sets the pen width.

Syntax

SETWIDTH number

Description

SETWIDTH defines the width of the line drawn by all active turtles. SETWIDTH takes a number between 1 and 999 as input. WIDTH reports the current line width. See also PENDOWN ,PENREVERSE, and PENERASE.

Example

(FOR "W 30 1 [SETWIDTH :W PD FD 3] -1)

SETX

Sets the X coordinate of a turtle.

Syntax

SETX x-coordinate

Description

SETX moves the turtle horizontally to the point specified by the input number. SETX does not affect the turtle's heading or its Y coordinate. See also SETY, SETXY, GETX, GETY, and GETXY.

Example

HOME
SETX 45

SETXY (SETPOS)

Sets the coordinates of a turtle.

Syntax

SETXY [x-coordinate y-coordinate]
(SETXY x-coordinate y-coordinate)

Description

SETXY moves the turtle to the point specified by its inputs. SETXY does not affect the turtle's heading. To obtain the X and Y coordinates of the turtle, use GETXY or the equivalent command, POS. SETXY accepts a two-element list of coordinates or two numeric inputs.

See also SETX, SETY, GETX, GETY, and GETXY.

Example

HOME
SETXY [50 50]

SETY

Sets the Y coordinate of a turtle.

Syntax

SETY y-coordinate

Description

SETY moves the turtle vertically to the point specified by the input number. SETY does not affect the turtle's heading or its X coordinate. See also SETX, SETXY, GETX, GETY, and GETXY.

Example

HOME
SETY 45

SHADOW

Reports the drop shadow for the first active turtle.

Syntax

SHADOW

Description

The SHADOW command reports the drop shadow for the first active turtle. This is a value between 0 and 99, and describes the offset in pixels of the drop shadow. The drop shadow simulates a light source towards the upper left corner of the display. A value of 3, for example, creates a neat little shadow underneath the turtle. The initial value is 0, which means no shadow at all. See also SETSHADOW.

Example

SHADOW
Result: 0

SHOWN? (SHOWNP)

Reports whether a turtle is visible.

Syntax

SHOWN?

Description

SHOWN? reports TRUE if the first active turtle is currently displayed on the graphics screen; otherwise, it reports FALSE. See also HIDETURTLE, and SHOWTURTLE.

SHOWTURTLE (ST)

Makes a turtle visible.

Syntax

SHOWTURTLE

Description

SHOWTURTLE makes the turtle shape visible. To make the turtle invisible, use HIDETURTLE. See also SHOWN?.

SLOWTURTLE

Slows down the turtle to half speed.

Syntax

SLOWTURTLE

Description

SLOWTURTLE slows down the execution speed of any movement commend. It is equivalent to the command SETSPEED 0.5. Use SETSPEED 1 to restore the turtle speed.

To retrieve the current speed, see SPEED.

Example

SLOWTURTLE
SPEED
Result: 0.5
SETSPEED 1

SPEED

Reports the speed in which turtle commands are executed.

Syntax

SPEED

Description

SPEED reports the current speed at which the turtle(s) moves on the screen. When Logo starts, the turtle speed is 1. Values range from 0.1 to 1; the lower the value is, the slower the turtle moves. Use SETSPEED to change the speed.

Example

SPEED
Result: 1

STAMPOVAL

Draws an oval.

Syntax

STAMPOVAL xradius yradius
(STAMPOVAL xradius yradius "TRUE)

Description

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. If STAMPOVAL, its inputs, and the value TRUE are all enclosed in parentheses, the oval drawn is filled with the current pattern in the current pen color. If the turtle's pen state is PENDOWN, STAMPOVAL colors the area with the current pen color. If the pen state is PENERASE, STAMPOVAL colors the area with the current background color, thus erasing the form. If the pen state is PENREVERSE, STAMPOVAL colors the area with the complement of the current area color; for example, white turns to black, and green to red. If the turtle's pen state is PENUP, STAMPOVAL has no effect. See also STAMPRECT.

Example

STAMPOVAL 100 100
(STAMPOVAL 50 50 TRUE)

STAMPRECT

Draws a rectangle.

Syntax

STAMPRECT width height
(STAMPRECT width height "TRUE)

Description

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. If STAMPRECT, its inputs, and the value TRUE are all enclosed in parentheses, the rectangle drawn is filled with the current pattern in the current pen color. If the turtle's pen state is PENDOWN, STAMPRECT colors the area with the current pen color. If the pen state is PENERASE, STAMPRECT colors the area with the current background color, thus erasing the form. If the pen state is PENREVERSE, STAMPRECT colors the area with the complement of the current area color; for example, white turns to black, and green to red. If the turtle's pen state is PENUP, STAMPRECT has no effect. See also STAMPOVAL.

Example

SETPC "RED
(STAMPRECT 40 60 "TRUE)
PU SETX 75 PD
SETPC "SILVER
(STAMPRECT 40 60 "TRUE)
STAMPRECT 40 60

STEPSIZE

Outputs the step size of the first active turtle or bitmap.

Syntax

STEPSIZE

Description

STEPSIZE outputs the distance, in pixels, that Logo turtles and widgets move with each FORWARD or BACK command, for the first active turtle or widget. By default, each Logo turtle and widget moves in steps of one pixel.

To set the step size, see SETSTEPSIZE.

Example

FD 10
SETSTEPSIZE 10
FD 10
STEPSIZE

TOWARDS

Reports the angle of a position compared to the turtle position.

Syntax

TOWARDS [xcoordinate ycoordinate]

Description

TOWARDS reports a number that is the heading that will point the turtle to the position specified by its input list. SETHEADING TOWARDS [xcoordinate ycoordinate] heads the turtle in the direction of its input list.

Example

ST
SETH 0
SETH TOWARDS [100 100]

TURTLESIZE (TSIZE)

Reports the scaling factor of a turtle.

Syntax

TURTLESIZE

Description

TURTLESIZE reports a number, the scaling factor of the current turtle. A turtle's scaling factor can be in the range of 0.1 to 99. If the turtle's scaling factors are different for the width and height, TURTLESIZE reports a two-element list with the scaling factors for the turtle's width and height.

To set the turtle's size, use SETTURTLESIZE.

TURTLETEXT (TT)

Prints its input on the Graphics canvas.

Syntax

TURTLETEXT whatToPrint

Description

TURTLETEXT prints its input (word or list) on the Graphics canvas at the position of the current turtle. TURTLETEXT prints in the pen color and font of the current turtle. TURTLETEXT has no effect if the turtle's pen is up.

See also FONT, SETFONT, TURTLETEXTSIZE and FONTS.

Example

TURTLETEXT [HELLO WORLD]

WIDTH

Reports the pen width.

Syntax

WIDTH

Description

WIDTH reports the pen width of the first active turtle. The pen width can be a number between 1 and 99. The pen width is set using the command SETWIDTH. If more than one turtle is active, the pen width of these turtles may be interrogated with WIDTH and the ASK or EACH command.

Example

DRAW
WIDTH
Result: 1
TELL [0 1 2 3 4]
SETWIDTH 5
EACH [PRINT WIDTH]
5
5
5
5
5