TERRAPIN LOGO FOR MACINTOSH

 

Commands arranged alphabetically

+-*/

math operations

ABS number

absolute value of number

BACK number

BK

moves turtle opposite direction

CLEAN

erases all graphics, does not affect turtle heading

CLEARGRAPHICS [

CG

clears current graphics, puts turtle home

COS number

cosine of angel measured in degrees

DISTANCE x y

determines distance to indicated position

EDIT

ED

Edits a file: edit "filename

END

terminates procedure

EXP number

inverse function of LN, e 2.7128

FILLSH [commands]

fills graphics region with pen pattern

FORWARD number

FD

moves turtle forward

HEADING

outputs heading from 0 to 360 degrees

HIDETURTLE

HT

make current turtle cursor disappear

HOME

moves cursor to home position

LEFT number

LT

turns left specified number of degrees

LN number

natural logarithm

LOAD filename

loads filename from memory

MAKE name value

make "varname value; assigns values to variable

NOWRAP

Allows turtle to move beyond boundary

PENDOWN

PD

puts pendown

PENERASE

PE

turns pen into eraser mode

PENPAINT

paints with current pen pattern and size

PENUP

PU

raises pen

POS

Outputs the turtles x and y coordinates

POTS

prints out titles of procedures

RANDOM number

random

REPEAT number [procedure]

repeat procedure specified number of times

RIGHT

RT

turns turtle to the right specified number of degrees

SAVE filename

saves filename

SETHEADING number

SETH

Rotates turtle to specified heading

SETPENMODE number

uses 0 to 7 as input, affects pattern

SETPENSIZE height width

SETPS

0 to 255 range

SETPPATTERN number

SETPP

1-38 patterns

SETXY x y

positions cursor with x and y coordinates

SIN number

sine of angel measured in degrees

SQRT number

square root of number

STAMPARC xradius yradius deg

creates an arc

STAMPOVAL width height

creates oval

STAMPRECT width height

creates rectangle

TO

define a procedure

TO procedure :x :y

defines a procedure with variables :x and :y

TOWARDS x y

outputs heading toward point

WRAP

wraps graphics within window

 

Commands Grouped by Function

QUOTIENT

math operations

Outputs integer of division of first divided by second

REMAINDER

math operations

outputs just the remainder of division, dropping the integer

RUN

math operations

executes the items in RL, especially if it is an equation

SIN

math operations

outputs the sine of angle expressed in degrees

SQRT

math operations

outputs the square root of input

SUM

math operations

adds two numbers which follow it together

PRINT (PR [data])

output

prints out specified data

TYPE

output

similar to PRINT but cursor doesn't move to next line

BacK (BK)

pen commands

Moves turtle a specified number of steps backwards

ForwarD (FD)

pen commands

Moves the turtle forward a specified number of steps

HideTurtle (HT)

pen commands

makes the turtle turn invisible

HOME

pen commands

moves the turtle to the origin (0,0) in the middle

LefT (LT)

pen commands

Turns the turtle a specified number of degrees to the left

PenDown (PD)

pen commands

puts pen down so that line is drawn when turtle is moved

PenErase (PE)

pen commands

pen acts like an eraser in this mode

PenUp (PU)

pen commands

lifts pen so no line is drawn when the turtle is moved

RighT (RT)

pen commands

turns the turtle a specified number of degrees to the right

SETHeading (SETH)

pen commands

Points the turtle in specified direction from 0 to 360 deg.

ShowTurtle (ST)

pen commands

shows turtle; important to get started

.Printer 0

printer

turns printer off

.PRINTER 1

printer

sends text to printer (in slot 1) rather than screen

EDit (ED)

procedures

Allows you to enter the EDIT mode to make procedures

END

procedures

Defines the end of a procedure

REPEAT # [procedure]

procedures

Causes procedure to be repeated specified number of times

TO (procedure name)

procedures

Signals the beginning of procedure

CLEAN

screen display

Erases all graphics but leaves turtle at last location

ClearScreen (CS)

screen display

Erases all graphics and puts turtle at origin (0,0) again

FENCE

screen display

Prevents turtle from exiting screen; terminates procedure

Fullscreen (Control-L)

screen display

gives full screen of graphics, no text

PEN

screen display

Outputs the state and color of the pen

SETBackGround (SETBG)

screen display

Sets background colors : 0-BK; 1-W; 2-G; 3-V; 4-O; 5-B

SETPenColor (SETPC)

screen display

Sets color of pen : 0-BK; 1-W; 2-G; 3-V; 4-O; 5-B

Splitscreen (Control-S)

screen display

gives graphics and text on same screen

Textscreen (Control-T)

screen display

Gives a full screen of text with no graphics

WINDOW

screen display

Allows turtle to leave screen but won't wrap around

WRAP

screen display

When turtle goes of screen it will wrap around on other side

PRint (PR [text])

text

prints out text specified in brackets

WAIT (# of 60ths of sec)

text

Delays next output by specified time

MAKE "varname varvalue

variable definition

defines vairable name to have a specific value

ERase (ER) "procedure name

workspace

erases specific procedure from workspace

ERaseALL (ERALL)

workspace

Erases all procedures in workspace

PrintOutTitleS (POTS)

workspace

Prints out titles of all procedures in workspace

 

SAMPLE TRANSFORMER PROCEDURES
 
LOGO PROCEDURES WRITTEN BY STEVE LEGE
transformers: a logo microworld
the computer teacher
may 1986; pp 33-37
 
For classroom use: You may copy this code from this word processor file directly into Logo and run it.
 
TO START
make "a 1
make "s 30
setpc 1
end
 
TO AXES
start
clearscreen
penup setpos [-140 0] pendown
setheading 90
fd 275
penup setpos [0 -119] pd
setheading 0
penup setpos [50 50] pendown
end
 
TO REFLECT.H
make "x -xcor
make "y ycor
make "h -heading
make "a -:a
penup setpoos se :x :y pendown
setheading :h
setpc 3
end
 
TO REFLECT.V
make "y -ycor
make "x xcor
if (or heading<180 heading=180) [make "h 180-heading]
if heading>180[make "h 540-heading]
make "a -:a
setheading :h
setpc 3
end
 
TO ROTATE :D
right :d
setpc 3
end
 
TO TRANSLATE :X :Y
penup
setpos se :s :y
pendown
setpc 3
end
 
TO RATIO :N
make "s :n*:s
setpc 3
end
 
TO REMEMBER
make "orig.s :s
make "origi.x xcor
make "origi.y ycor
make "origi.a :a
make "orig.h heading
end
 
TO REPLACE
setpos se :orig.x orig.y
setheading :orig.h
setpc 1
pendown
make "a :orig.a
make "s :orig.s
end
 
TO BOX
repeat 2[fd :s rt 90*:a fd :s*2 rt 90*:a]
mark
end
 
TO MARK
repeat 4[fd 6 rt 90*:a]
end
 
TO RT.TRI
fd :s rt 120*:a
fd :s*2 rt 150*:a
fd :s*1.73 rt 90*:a
mark
end
 
TO SQ
pu bk :s/2 lt 90*:a pd
fd :s/2 rt 90*:a]
mark
repeat 3 [fd :s rt 90*:a]
fd :s/2 rt 90*:a
pu fd :s/2 pd
end
 
TO PENTA
pu bk :s/2*1.37 pd
lt 90 * :a mark
fd :s/2 rt :a*72
repeat 2 [fd :s rt 72*:a]
lt 72*:a
repeat 3[rt 120*:a fd 9]
rt 72*:a
repeat 2[fd :s rt 72 * :a]
fd :s/2 rt 90 * :a
pu fd :s/2 * 1.37 pd
end
 
TO TEE
pu lt 90 * :a fd 5 pd
fd 25 rt 90*:a
mark
fd 10 rt 90*:a
fd 60 rt 90*:a
fd 10 rt 90*:a
fd 25 lt 90*:a
fd 40 rt 90*:a
fd 10 rt 90*:a
fd 40 rt 90*:a
pu fd 5 lt 90*:a pd
end