Turtle Graphics Vocabulary

Commands [and their abreviations]

forward 100 [fd 100]
Moves the turtle 100 pixels at the current heading.
back 100 [bk 100]
Moves the turtle back 100 pixels at the current heading.
right 30 [rt 30]
Rotates the turtle clockwise through a 30 degree angle.
left 30 [lt 30]
Rotates the turtle counterclockwise through a 30 degree angle.
setHeading 45 [seth 45]
Directs the turtle to an angle of 45 degrees. (All angles are measured in the usual Cartesian manner, that is counterclockwise from 3 O'clock.)
setX 30
Moves the turtle horizontally to the coordinate x = 30.
setY 40
Moves the turtle vertically to the coordinate y = 40.
setXY 30,40
Moves the turtle to the coordinates 30,40.
incXY 3,4
Increases the x coordinate of the turtle by 3 and the y coordinate by 4.

Functions


xcor ( )
Returns the turtle’s x coordinate.
ycor ( )
Returns the turtle’s y coordinate.
xyCor ( )
Returns a list of the turtle’s x and y coordinates.
heading ( )
Returns the turtle's heading.
direction (30,40) or toward(30,40)
Returns the direction of the point 30,40 from the current location of the turtle. It does not rotate the turtle.
distance (30,40)
Returns the distance from the current location of the turtle to the point 30,40.
clickPoint ( )
Returns the x and y coordinates of the point of the mouse click--useful in importing data into a program.
Intersection(ax,ay,bx,by)
Returns the intersection of two lines whose endpoints are ax, ay and bx, by.

Miscellaneous


StartTurtle [st] tName
Initiates the turtle (control) with the name tName, giving the control the custom properties of x, y coordinates, heading, pen state (up or down) and graphic points. The associated graphic (trace)is {tName} &"grc"
Tell tName
Tell the turtle who he is talking to.
home
Moves the turtle to the origin and pointing to the right.
setHome 30,40
Sets the home position of the turtle a distance 30 to the right of screen-center, and a distance 40 above screen-center. (It does not move the turtle home.)
cleanG tName
Clears the graphic points but not the graphic. If tName is omitted, it clears all graphic points.
penUp [pu]
Raises the drawing pen. The turtle will no longer leave a track as he moves.
penDown [pd]
Lowers the drawing pen.
TurtlePtToMousePt
Converts turtle coordinates, measured from the screen's center, to mouse coordinates, measured from the upper left.
MousePtToTurtlePt
See above.
centeredCircle 5
Draws a circle, centered about the current turtle position, of radius 5.
Label "x"
Prints an “x” (or whatever you place within quotes) at the current turtle location.
sci (num,sig)
Returns the input num in scientific notation with "sig" significant figures, e.g. sci(312345.67, 3) becomes 3.12*10^5.
commaFormat(num)
Returns the num with commas delimiting each triplet, i.e. commaFormat(9999999) returns 9,999,999.
SetColor red
Sets the forecolor of the active turtle to red. Must follow Tell.
SetSize 3
Sets the linesize of the active turtle to 3
SetArrow true
Sets the end arrow of the active turtle to true.