subturtl.icn: Procedures for turtle-graphics (subset version)

procedure TInit:           initialize turtle system
procedure TReset:          reset turtle system
procedure TDraw:           draw with turtle
procedure TDrawto:         draw to with turtle
procedure TSkip:           skip with turtle
procedure TGoto:           goto with turtle
procedure TRight:          turn turtle right
procedure TLeft:           turn turtle left
procedure TFace:           turn turtle to face point
procedure TX:              turtle x coordinate
procedure TY:              turtle y coordinate
procedure THeading:        turtle heading
procedure TSave:           save turtle state
procedure TRestore:        restore turtle state

link subturtl
January 30, 1996; Gregg M. Townsend
Requires: Version 9 graphics
See also: turtle.icn
This file is in the public domain.

These procedures implement a simplified subset of the turtle.icn
package.  The main omissions are scaling, TWindow(), THome(), and
high-level primitives like TCircle().  Some procedures accept fewer
arguments, omit defaults, or omit the return value.
____________________________________________________________

The procedures are as follows:

TDraw(n) -- move forward and draw
TSkip(n) -- skip forward without drawing
     The turtle moves forward n units.  n can be negative to move
     backwards.

TDrawto(x, y) -- draw to the point (x,y)
     The turtle turns and draws a line to the point (x,y).
     The heading is also set as a consequence of this movement.

TGoto(x, y) -- set location
     The turtle moves to the point (x,y) without drawing.
     The turtle's heading remains unaltered.

TRight(d) -- turn right
TLeft(d) -- turn left
     The turtle turns d degrees to the right or left of its current
     heading.  Its location does not change, and nothing is drawn.

TFace(x, y) -- set heading
     The turtle turns to face directly to face the point (x,y).
     If the turtle is already at (x,y), the heading does not change.

TX() -- query current x position
TY() -- query current y position
     The x- or y-coordinate of the turtle's current location is
     returned.

THeading() -- query heading
     The turtle's heading (in degrees) is returned.

TSave() -- save turtle state
TRestore() -- restore turtle state
     TSave saves the current turtle window, location, and heading
     on an internal stack.  TRestore pops the stack and sets
     those values, or fails if the stack is empty.

TReset() -- clear screen and reinitialize
     The window is cleared, the turtle moves to the center of the
     screen without drawing, the heading is set to -90 degrees, and
     the TRestore() stack is cleared.  These actions restore the
     initial conditions.

Source code | Program Library Page | Icon Home Page