GRAPHICS ======== The center of the graphics window is turtle location [0 0]. Positive X is to the right; positive Y is up. Headings (angles) are measured in degrees clockwise from the positive Y axis. (This differs from the common mathematical convention of measuring angles counterclockwise from the positive X axis.) The turtle is represented as an isoceles triangle; the actual turtle position is at the midpoint of the base (the short side). TURTLE MOTION ------------- FORWARD dist FD dist moves the turtle forward, in the direction that it's facing, by the specified distance (measured in turtle steps). BACK dist BK dist moves the turtle backward, i.e., exactly opposite to the direction that it's facing, by the specified distance. (The heading of the turtle does not change.) LEFT degrees LT degrees turns the turtle counterclockwise by the specified angle, measured in degrees (1/360 of a circle). RIGHT degrees RT degrees turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle). CLEARSCREEN CS erases the graphics window and sends the turtle to its initial position and heading. HOME moves the turtle to the center of the screen. PEN CONTROL ----------- The turtle carries a pen that can draw pictures. At any time the pen can be UP (in which case moving the turtle does not change what's on the graphics screen) or DOWN (in which case the turtle leaves a trace). PENDOWN PD sets the pen's position to DOWN, without changing its mode. PENUP PU sets the pen's position to UP, without changing its mode. SETPENCOLOR colornumber SETPC colornumber sets the pen color to the given number, which must be a nonnegative integer. Color 0 is always black; color 7 is always white. Other colors may or may not be consistent between machines. SETBACKGROUND color SETBG color set the screen background color. CONTROL STRUCTURES ================== REPEAT num instructionlist command. Runs the "instructionlist" repeatedly, "num" times. Example: REPEAT 4 [FD 100 RT 90] BYE command. Exits from Logo; returns to the operating system. WORKSPACE MANAGEMENT ==================== PROCEDURE DEFINITION -------------------- TO procname :input1 :input2 ... (special form) command. Prepares Logo to accept a procedure definition. The procedure will be named "procname" and there must not already be a procedure by that name. The inputs will be called "input1" etc. Any number of inputs are allowed, including none. Names of procedures and inputs are case-insensitive. Unlike every other Logo procedure, TO takes as its inputs the actual words typed in the instruction line, as if they were all quoted, rather than the results of evaluating expressions to provide the inputs. (That's what "special form" means.) Logo responds to the TO command by entering procedure definition mode. The prompt character changes from "?" to ">" and whatever instructions you type become part of the definition until you type a line containing only the word END. Example: TO SQUARE :SIZE REPEAT 4 [FD SIZE RT 90] END WORKSPACE CONTROL ----------------- SAVE filename command. Saves the definitions of all unburied procedures, variables, and property lists in the named file. Example: SAVE "I:/MA562/FRIEZES.TXT LOAD filename command. Reads instructions from the named file and executes them. The file can include procedure definitions with TO, and these are accepted even if a procedure by the same name already exists. If the file assigns a list value to a variable named STARTUP, then that list is run as an instructionlist after the file is loaded. Example: LOAD "I:/MA562/FRIEZES.TXT