LOGO Primitives

 

Command

Short Form

Example

Description

Chapter 13

SETX

 

SETX 200

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.

SETY

 

SETY 100

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.

SETXY

 

SETXY [100 150]

SETXY moves the turtle to the point specified by its input list. The first element is the X coordinate (horizontal); the second, the Y coordinate (vertical).

XCOR

 

XCOR

XCOR outputs the X coordinate of the turtle's position in the Graphics window.

YCOR

 

YCOR

YCOR outputs the Y coordinate of the turtle's position in the Graphics window.

HEADING

 

HEADING

HEADING reports the turtle's heading, an integer from 0 to 359, 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.

SETHEADING

 

SETH  270

SETHEADING turns the turtle to the degree position specified by its input. Positive numbers turn the turtle clockwise. 0 is straight up, 90 is straight right, 180 is straight down, 270 is straight left, and 360 is the same as 0.

TOWARDS

 

TOWARDS [100 100]

TOWARDS reports a number that is the heading that will point the turtle to the position specified by its input list.  This can be used together with SETH as in the following example:

SETH TOWARDS [100 100]

GETXY

 

GETXY

GETXY reports a list consisting of the x and y coordinates of the turtle.

DISTANCE

 

DISTANCE [200 200]

DISTANCE reports a number which is the distance in turtle steps from the current turtle location to the specified point.

DOT

 

DOT [150 150]

DOT places a dot at the point determined by its inputs. The dot is displayed in the current pen color. The size of the dot reflects the pen width of the first active turtle.

DOTCOLOR

 

DOTCOLOR [150 150]

DOTCOLOR reports the color of the pixel identified by its argument. The color is reported as a list of Red, Green, and Blue values.

SETWINSIZE

 

SETWINSIZE “graphics [800 400]

SETWINSIZE sets the size of a window. Its input is the name of the window to resize, and a list of two numbers: the width of the window in screen pixels and the window height. WINSIZE reports the current window size. Note that this command changes the size of the window's drawing area.

WINSIZE

 

WINSIZE

WINSIZE reports the size of the drawing area of a window as a list with two elements. The first element is the width in pixels and the second is the height in pixels. The input specifies the target window by its name.