Predefined turtle graphics routines

turtle movement: forward    backward    moveTo    home   
turtle orientation: left right turnTo
turtle status: getHeading getX getY getPen
drawing control: penUp penDown drawString erase

backward
arguments: one integer (number of steps)
result: moves the turtle the specified number of steps opposite the current heading - if the pen is down, a line will be drawn.
example call: backward(20);

drawString
arguments: one string (a message)
result: displays the specified message at the current turtle location.
example call: drawString("Here I am!");

erase
arguments: none
result: erases the turtle graphics screen (resets to all white).
example call: erase();

forward
arguments: one integer (number of steps)
result: moves the turtle the specified number of steps in the current heading- if the pen is down, a line will be drawn.
example call: forward(20);

getHeading
arguments: none
result: returns the current heading of the turtle, a number between 0 and 359. Recall, 0 is straight up (north), 90 is straight right (east), 180 is straight down (south), and 270 is straight left (west).
example call: currHead := getHeading();

getPen
arguments: none
result: returns the current state of the turtle pen, either "up" or "down".
example call: currPen := getPen();

getX
arguments: none
result: returns the current X-coordinate (horizontal axis) of the turtle. Recall, (0,0) is the center of the turtle graphics screen.
example call: currX := getX();

getY
arguments: none
result: returns the current Y-coordinate (vertical axis) of the turtle. Recall, (0,0) is the center of the turtle graphics screen.
example call: currY := getY();

home
arguments: none
result: moves the turtle to the center of the turtle graphics screen (0,0), facing straight up - if the pen is down, a line will be drawn.
example call: home();

left
arguments: one number (number of degrees)
result: turns the turtle the specified number of degrees to the left, relative to the current heading. (Note: a full turn is 360 degrees)
example call: left(90);

moveTo
arguments: two integers (X and Y coordinates)
result: moves the turtle to the specified coordinates, with (0,0) being the center of the turtle graphics screen - if the pen is down, a line will be drawn.
example call: moveTo(50,100);

penDown
arguments: none
result: puts the turtle pen down on the screen - any subsequent movement will cause a line to be drawn.
example call: penDown();

penUp
arguments: none
result: lifts the turtle pen up off the screen - no lines will be drawn regardless of turtle movement.
example call: penUp();

right
arguments: one number (number of degrees)
result: turns the turtle the specified number of degrees to the right, relative to the current heading. (Note: a full turn is 360 degrees)
example call: right(90);

turnTo
arguments: one number (number of degrees)
result: turns the turtle the specified heading, where 0 is straight up (north), 90 is straight right (east), 180 is straight down (south), and 270 is straight left (west).
example call: turnTo(0);