Logo Works: Lessons in Logo files
These Logo procedures are referenced in Logo Works: Lessons in Logo, the step-by-step workbook for beginning Logo programmers. Logo Works: Lessons in Logo is a set of 46 consecutive lessons about programming with Logo. It was written by a group of teachers in Chapel Hill, North Carolina targeted at their students from 4th to 8th grade, though it works well for beginning students of any age. The Logo Works lessons are based on the turtle graphics part of Logo and begin with moving the turtle and progress through angles, repeating, the total turtle trip, writing procedures and using recursion up through construction of multi-level projects. Each lesson has worksheets and suggested activities along with challenges.
These procedures are example procedures that are referenced by and support the Logo Works curriculum. Load the file into Logo and use the calling procedures to call each one. Alternatively, copy the file you would like and paste it into a Logo editor and define it.
LogoWorks.lgo
; BEDROOM file
TO INNERWALL
LEFTWALL
WINDOWS
BACKWALL
WINDOWS
FRONTWALL
END
TO DOOR
REPEAT 2 [FD 50 RT 90 FD 5 RT 90]
END
TO OUTERWALL
FD 160 LT 90
FD 180 LT 90
FD 230 LT 90
FD 180 LT 90
FD 20
END
TO ROOM
DRAW
PU BK 85 RT 90 BK 60 PD
OUTERWALL
LT 90
FD 4 RT 60
DOOR
LT 60 FD 4
LT 90
INNERWALL
PU HOME PD
END
TO FRONTWALL
FD 54 RT 90
FD 152 LT 90
FD 8 LT 90
END
TO WINDOWS
LT 90
FD 8 RT 90
FD 50 RT 90
FD 8 LT 90
END
TO BACKWALL
FD 144 RT 90
FD 60
END
TO LEFTWALL
FD 12 RT 90
FD 164 RT 90
FD 20
END
ROOM
; BOOKCASE file
TO BOOKCASE
DRAW
HT PU BK 90 RT 90 PD
FRAME
PU BK 58 LT 90 FD 25 PD
SHELF1
PU FD 59 PD
SHELF2
PU FD 52 PD
SHELF2
PU HOME PD ST
END
TO SHELF2
REPEAT 2 [FD 48 RT 90 FD 116 RT 90]
END
TO SHELF1
REPEAT 2 [FD 55 RT 90 FD 116 RT 90]
END
TO LTMOULDING
RT 30
FD 5 RT 60
FD 2 LT 60
FD 5 LT 120
END
TO RTMOULDING
LT 120 FD 5
LT 60 FD 2
RT 60 FD 5
RT 30
END
TO FRAME
FD 70
RTMOULDING
FD 180
LT 90 FD 126 LT 90
FD 180
LTMOULDING
FD 70
END
BOOKCASE
; CAR file
TO LARC :N
LT 5 REPEAT :N [FD 1 LT 10]
RT 5
END
TO TIRE
FD 20 LARC 9
FD 20 LARC 9
FD 20
END
TO BUMPER
FD 5 LARC 9 FD 10 LARC 9 FD 5
END
TO ROOF
RT 70
FD 65 LARC 7
FD 102
LARC 7 FD 65
RT 70
END
TO RTFENDER
FD 40 LARC 9 FD 3
END
TO LTFENDER
FD 3 LARC 9 FD 40
END
TO CAR
DRAW
PU BK 50 RT 90 PD
FD 80 BK 40
RT 90
TIRE
RT 90
FD 10 LARC 9 FD 10
RT 90
BUMPER
RT 90
RTFENDER
ROOF
LTFENDER
RT 90
BUMPER
RT 90
FD 10 LARC 9 FD 82 BK 70
RT 90
TIRE
END
CAR
; CONNECT file
TO LARC :N
LT 5 REPEAT :N [FD 1 LT 10]
RT 5
END
TO TIRE
FD 20 LARC 9
FD 20 LARC 9
FD 20
END
TO BUMPER
FD 5 LARC 9 FD 10 LARC 9 FD 5
END
TO ROOF
RT 70
FD 65 LARC 7
FD 102
LARC 7 FD 65
RT 70
END
TO RTFENDER
FD 40 LARC 9 FD 3
END
TO LTFENDER
FD 3 LARC 9 FD 40
END
TO CAR
DRAW
PU BK 50 RT 90 PD
FD 80 BK 40
RT 90
TIRE
RT 90
FD 10 LARC 9 FD 10
RT 90
BUMPER
RT 90
RTFENDER
ROOF
LTFENDER
RT 90
BUMPER
RT 90
FD 10 LARC 9 FD 82 BK 70
RT 90
TIRE
END
CAR
; FISH file
TO MOVE :SIZE :FAR
HT
SETPC 1
FISH :SIZE
CLEAN
PU
FD :FAR
PD
MOVE :SIZE :FAR
END
TO VEE :SIZE
LT 135
FD :SIZE
BK :SIZE
LT 90
FD :SIZE
BK :SIZE
LT 135
END
TO ARCR90 :SIZE
REPEAT 5 [FD :SIZE RT 18]
END
TO FISH :SIZE
REPEAT 2 [ARCR90 :SIZE RT 90]
RT 45 VEE :SIZE * 2
LT 45
END
; GALAXY file
TO GALAXY :SIDE :ANGLE
PU
FD :SIDE
PD
FD 1
RT :ANGLE
GALAXY :SIDE + 5 :ANGLE
END
; GALAXY2 file
TO GALAXY :SIDE :ANGLE
PU
FD :SIDE
PD
FD 1
RT :ANGLE
; make "side :SIDE * 1.5
make "side :SIDE + 1
; make "side :SIDE + 5
GALAXY :SIDE :ANGLE
END
; MAP file
TO TINY.ISLE
PU SETXY [-100 -60] PD SETH 0
LT 80 FD 5
LT 90 FD 7
RT 90 FD 3
RT 90 FD 5
LT 110 FD 10
LT 100 FD 10
LT 30 FD 10
LT 40 FD 5
LT 20 FD 5
LT 30 FD 5
LT 60 FD 5
LT 40 FD 5
SETXY [-100 -60]
END
TO SPLIT.ISLE1
PU SETXY [230 50] PD SETH 0
LT 80 FD 10 LT 30 FD 7
RT 30 FD 20 LT 60 FD 20
RT 5 FD 5 RT 30 FD 5
LT 30 FD 8 RT 60 FD 5
LT 80 FD 7 LT 90 FD 10
RT 110 FD 15 RT 105 FD 5
LT 20 FD 5 LT 20 FD 5
LT 30 FD 5 RT 30 FD 5
RT 30 FD 5 RT 60 FD 5
LT 40 FD 5 LT 30 FD 5
LT 80 FD 5 RT 20 FD 10
LT 20 FD 5 RT 90 FD 10
RT 80 FD 5 RT 60 FD 5
LT 60 FD 3 LT 30 FD 13
LT 120 FD 10 LT 10 FD 15
RT 50 FD 10 RT 120 FD 5
RT 60 FD 5
LT 120 FD 10
RT 110 FD 5
LT 40 FD 5
LT 30 FD 5
END
TO SPLIT.ISLE2
LT 30 FD 10
LT 45 FD 10
RT 140 FD 20
RT 30 FD 5
LT 60 FD 5
LT 60 FD 20
RT 95 FD 15
RT 105 FD 7
LT 30 FD 10
LT 30 FD 5
LT 30 FD 10
LT 30 FD 10
RT 90 FD 15
LT 130 FD 10
LT 30 FD 5
LT 30 FD 10
LT 30 FD 5
RT 90 FD 15
RT 40 FD 10
RT 110 FD 5
LT 100 FD 10
LT 85 FD 10
RT 45 FD 10
RT 90 FD 5
RT 90 FD 10
LT 90 FD 20
RT 80 FD 10
LT 90 FD 10
LT 50 FD 5
RT 20 FD 10
SETXY [230 50]
PU SETXY [-88 50] PD
END
TO LT.ISLE
PU SETXY [-35 25] PD SETH 0 LT 90
LT 45 FD 10
RT 135 FD 8
LT 90 FD 10
LT 90 FD 6
RT 90 FD 10 LT 90 FD 10
LT 60 FD 10 RT 130 FD 10
LT 100 FD 13
RT 150 FD 10
LT 120 FD 10
LT 5 FD 10
RT 75 FD 7
LT 90 FD 10
LT 90 FD 10
RT 90 FD 10
RT 40 FD 5
RT 40 FD 5
RT 40 FD 5
RT 20 FD 15
RT 60 FD 15
RT 40 FD 15
LT 100 FD 10
RT 110 FD 5
LT 140 FD 20
LT 90 FD 5
RT 45 FD 10
RT 60 FD 10
RT 15 FD 10
LT 15 FD 8
RT 60 FD 10
RT 20 FD 10
RT 30 FD 10
RT 30 FD 10
RT 60 FD 20
LT 110 FD 10
LT 90 FD 10
RT 110 FD 15
RT 90 FD 15
LT 45 FD 5
LT 45 FD 10
LT 90 FD 5
RT 110 FD 10
RT 80 FD 10
LT 40 FD 5
RT 30 FD 5
LT 20 FD 5
SETXY [-35 25]
END
TO CENTER.ISLE
PU SETXY [25 -5] PD SETH 0
RT 90
FD 10 RT 85
FD 10 LT 90
FD 10 LT 90
FD 15 LT 70
FD 15 RT 90
FD 10 RT 70
FD 15 RT 70
FD 15 LT 50
FD 30 RT 60 FD 10 RT 90
FD 5 LT 90
FD 30 RT 90
FD 15 RT 140
FD 10 LT 140
FD 15 LT 110
FD 10 RT 70
FD 15 RT 120
FD 20 LT 90
FD 20 RT 90
FD 10 LT 30
FD 20 LT 110
FD 10 RT 70
FD 20
RT 110 FD 5
RT 50 FD 15
LT 140 FD 10
RT 100 FD 15
LT 95 FD 10
LT 10 FD 15
RT 120 FD 10
LT 5 FD 15
RT 120 FD 10
LT 90 FD 10
LT 80 FD 10
RT 150 FD 20
SETXY [25 -5]
END
TO BOAT
PU SETXY [0 70] PD SETH 0
RT 45 FD 10
LT 135 FD 10
RT 90 FD 10
LT 90 FD 7
REPEAT 2 [RT 90 FD 10 RT 90 FD 14]
BK 7 RT 90
BK 10 LT 90
FD 20 RT 90
FD 5 LT 90 FD 7
REPEAT 2 [RT 90 FD 10 RT 90 FD 14]
BK 7 RT 90
BK 5 LT 90
FD 10
RT 45 BK 10
LT 45 BK 25
END
TO PERSON
SETH 0
REPEAT 4 [FD 5 RT 90]
RT 90 FD 5
RT 135 FD 12 BK 8
LT 90 FD 8 BK 8
RT 45 FD 6
RT 30 FD 8 BK 8
LT 60 FD 8 BK 8
END
TO PEOPLE
PU SETXY [190 75] PD
PERSON
PU SETXY [115 65] PD
PERSON
PU SETXY [134 55] PD
PERSON
PU SETXY [60 -20] PD
PERSON
PU SETXY [20 -20] PD
PERSON
PU SETXY [-80 15] PD
PERSON
END
TO NORTH.SOUTH
PU LT 98 FD 45 PD LT 2
FD 10 LT 30
BK 11 RT 30 FD 10
PU BK 105 PD
RT 90 BK 7 FD 7
LT 90 FD 6 LT 90 FD 6
RT 90 FD 5
RT 90 FD 5
END
TO QTR.COMPASS
RT 10 FD 30
RT 70 FD 30
LT 178
FD 31 BK 31
RT 2 FD 32 BK 32
RT 2 FD 33 BK 33
RT 2 FD 34 BK 34
RT 2 FD 35 BK 35
END
TO COMPASS
PD SETH 0
LT 10
FD 30 BK 30
RT 2 FD 31 BK 31
RT 2 FD 32 BK 32
RT 2 FD 33 BK 33
RT 2 FD 34 BK 34
RT 2 FD 35 BK 35
QTR.COMPASS
QTR.COMPASS
QTR.COMPASS
RT 10 FD 30
NORTH.SOUTH
END
TO MAP
DRAW
TINY.ISLE
SPLIT.ISLE1
SPLIT.ISLE2
LT.ISLE
CENTER.ISLE
BOAT
PEOPLE
PU SETXY [200 180]
COMPASS
PU SETXY [22 2] PD SETH 0
END
DRAW
MAP
; MAZE1 file
TO MAZE1
DRAW
PU BK 55 LT 90 FD 127.50 RT 90 PD
BORDER
PU FD 10 RT 90 FD 40 LT 90 PD
L
PU RT 90 FD 110 LT 90 PD
G
PU FD 140 RT 90 FD 105 RT 90 PD
BORDER
PU FD 10 RT 90 FD 40 LT 90 PD
O
PU RT 90 FD 110 LT 90 PD
O
PU FD 85 LT 90 FD 22.50 LT 90
HOME PD
END
TO L
FD 25 LT 90
FD 15 RT 90
FD 80 RT 90
FD 10 RT 90
FD 70 LT 90
FD 30 RT 90
FD 10 RT 90
FD 15 LT 90
FD 25 RT 90
PU FD 10 PD
RT 90
END
TO G
FD 25 LT 90
FD 15 RT 90
FD 80 RT 90
FD 40 RT 90
FD 30 RT 90
FD 10 RT 90
FD 20 LT 90
FD 20 LT 90
FD 60 LT 90
FD 20 LT 90
FD 20 LT 90
FD 10 RT 90
FD 10 RT 90
FD 20 RT 90
FD 40 RT 90
FD 15 LT 90
FD 25 RT 90
PU FD 10 PD
RT 90
END
TO BORDER
FD 10 RT 90
FD 40
PU FD 10 PD
FD 100
PU FD 10 PD
FD 85 LT 90
FD 115 RT 90
FD 10 RT 90
FD 125 RT 90
FD 255 RT 90
END
TO O
FD 25 LT 90
FD 15 RT 90
FD 80 RT 90
FD 40 RT 90
FD 80 RT 90
FD 15 LT 90
FD 25
PU BK 35 RT 90 BK 5 PD
REPEAT 2 [FD 20 RT 90 FD 60 RT 90]
PU FD 15 RT 90 BK 35 PD
END
MAZE1
; MAZE2 file
TO MAZE2
DRAW
PU BK 45 RT 90 PD
FD 40 LT 120
FD 60 BK 20 RT 60
FD 20 LT 60
FD 60 LT 120
FD 60
PU FD 20 PD
FD 40 LT 120
FD 60 BK 40 LT 60
PU FD 20 PD
FD 60 BK 60
PU BK 20 PD
LT 120
FD 20 LT 60
FD 20 LT 120
BK 20 FD 80 RT 60
FD 20 LT 60
FD 80 BK 180 LT 60
PU FD 20 PD
FD 180 RT 120
FD 200 BK 100 RT 60
FD 20 LT 60
FD 60 RT 120
FD 60
PU HOME PD
END
MAZE2
; MAZE3 file
TO MAZE3
DRAW
PU RT 90 FD 15 RT 90 FD 22
PD
BR.1
PU FD 15 PD
BR.1
PU FD 55 LT 90 BK 5 PD
BR.2
PU FD 20 PD
BR.2
PU FD 85 RT 90 BK 35 PD
BR.3
PU FD 20 PD
BR.3
LT 90
REPEAT 90 [FD 1.30 LT 2]
FD 150
REPEAT 90 [FD 1.30 LT 2]
PU RT 90 FD 20 RT 90 PD
REPEAT 90 [FD 2 RT 2]
FD 60 LT 90
FD 10 RT 90
PU FD 30 RT 90 PD
FD 10 LT 90
FD 60
REPEAT 90 [FD 2 RT 2]
PU FD 75 RT 90 FD 5 PD
END
TO BR.3
FD 70 RT 90
FD 150 RT 90
FD 70
END
TO BR.2
FD 35 LT 90
FD 95 LT 90
FD 35
END
TO BR.1
FD 10 RT 90 FD 30 RT 90
FD 10
END
MAZE3
; POLYGONS file
TO POLYGON :SIDES :LEN
IF :SIDES < 3 STOP
LOCAL "ANGLES
MAKE "ANGLES 360 / :SIDES
REPEAT :SIDES [FD :LEN RT :ANGLES]
END
TO TRISTAMP :IMAGE
PU
SETX ((FIRST GETXY) - 16)
SETY ((FIRST BUTFIRST GETXY) - 16)
(STAMP :IMAGE)
SETX ((FIRST GETXY) + 16)
SETY ((FIRST BUTFIRST GETXY) + 16)
END
TO POLYSTAMP :SIDES :LEN :IMAGE
POLYGON :SIDES :LEN
TRISTAMP :IMAGE
PU
SETX ((FIRST GETXY) + (:LEN * 4))
PD
END
TO REG.POLYGONS
DRAW
LOCAL "TRICURSOR
MAKE "TRICURSOR LOADSNAP "TRIANGLECURSOR
PU
SETX (-30 * 4 * 4)
PD
POLYSTAMP 3 30 :TRICURSOR
POLYSTAMP 4 30 :TRICURSOR
POLYSTAMP 5 30 :TRICURSOR
POLYSTAMP 6 30 :TRICURSOR
POLYSTAMP 8 30 :TRICURSOR
POLYSTAMP 9 30 :TRICURSOR
POLYSTAMP 10 30 :TRICURSOR
ERASE :TRICURSOR
HT
END
TO DASHED.LINE :LEN :DASHON :DASHOFF
PD
WHILE [:LEN > 0] [
IF :DASHON > :LEN [MAKE "DASHON :LEN]
FD :DASHON
MAKE "LEN :LEN - :DASHON
PU
IF :DASHOFF > :LEN [MAKE "DASHOFF :LEN]
FD :DASHOFF
MAKE "LEN :LEN - :DASHOFF
PD
]
END
TO S.DASHED.LINE :LEN :DASHON :DASHOFF
LOCAL "OLDPEN
MAKE "OLDPEN PENDOWN?
DASHED.LINE :LEN :DASHON :DASHOFF
PU
BK :LEN
IF :OLDPEN [PD] [PU]
END
TO S.ARROW.HEAD :LEN
LOCAL "A
MAKE "A 30
PD
RT :A
BK :LEN
FD :LEN
LT (:A * 2)
BK :LEN
FD :LEN
RT :A
END
TO S.ARCR :RADIUS :ANGLE :O
(LOCAL "P "D "H)
MAKE "P GETXY
MAKE "D PENDOWN?
MAKE "H HEADING
PU
FD :RADIUS + :O
RT 90
FD :O
PD
ARCR :RADIUS :ANGLE
S.ARROW.HEAD 10
PU
SETXY :P
SETH :H
IF :D [PD] [PU]
END
TO S.ARCL :RADIUS :ANGLE :O
(LOCAL "P "D "H)
MAKE "P GETXY
MAKE "D PENDOWN?
MAKE "H HEADING
PU
FD :RADIUS + :O
LT 90
FD :O
PD
ARCL :RADIUS :ANGLE
S.ARROW.HEAD 10
PU
SETXY :P
SETH :H
IF :D [PD] [PU]
END
TO POLYGON.DASHES :SIDES :LEN
IF :SIDES < 3 STOP
LOCAL "ANGLES
MAKE "ANGLES 360 / :SIDES
REPEAT :SIDES [FD :LEN S.DASHED.LINE :LEN 4 6 S.ARCR :30 :ANGLES 10 RT :ANGLES]
END
TO CIRCLEL :RADIUS
REPEAT 36 [LT 5 FD 2 * :RADIUS * PI / 36 LT 5]
END
TO CIRCLER :RADIUS
REPEAT 36 [RT 5 FD 2 * :RADIUS * PI / 36 RT 5]
END
TO ARCL :RADIUS :DEGREES
LOCAL "STEP LOCAL "REM
MAKE "STEP 2 * :RADIUS * 3.14 / 36
MAKE "REM REMAINDER :DEGREES 10
REPEAT :DEGREES / 10 [LT 5 FD :STEP LT 5]
IF :REM > 0 [FD :STEP * :REM / 10 LT :REM]
END
TO ARCR :RADIUS :DEGREES
LOCAL "STEP LOCAL "REM
MAKE "STEP 2 * :RADIUS * 3.14 / 36
MAKE "REM REMAINDER :DEGREES 10
REPEAT :DEGREES / 10 [RT 5 FD :STEP RT 5]
IF :REM > 0 [FD :STEP * :REM / 10 RT :REM]
END
; [FD RT] pairs:
MAKE "ANGLE.OFFSETS [[0 -6] [10 -5] [15 7] [0 7]]
TO SHOW.ANGLE :LEN :AXIS.NUM
PU
PSETHEADING (90 * :AXIS.NUM)
MAKE "THIS.OFFSET (ITEM (:AXIS.NUM + 1) :ANGLE.OFFSETS)
MAKE "EXTRA.FD FIRST :THIS.OFFSET
MAKE "EXTRA.RT FIRST BUTFIRST :THIS.OFFSET
FD :LEN + 10 + :EXTRA.FD
RT 90
FD :EXTRA.RT
PD
TT (90 * :AXIS.NUM)
PU
BK :EXTRA.RT
LT 90
BK :LEN + 10 + :EXTRA.FD
END
TO HALF.AXIS :LEN :ARROW.LEN
PD
FD :LEN
S.ARROW.HEAD :ARROW.LEN
PD
BK :LEN
END
TO AXES :LEN :ARROW.LEN
FOR "I 0 3 [
SHOW.ANGLE :LEN :I
HALF.AXIS :LEN :ARROW.LEN
]
END
TO POLAR.COORDS
CS
AXES 100 15
PSETH 0
PD
S.ARCL 50 45 0
PSETH 45
FD 150
SETH 0
STAMP
PU
HT
PSETH 45
BK 60
LT 90
FD 15
PD
TT "|d|
PU BK 7 RT 90 FD 10 PD HALF.AXIS 40 5
PU RT 180 FD 30 PD HALF.AXIS 40 5
PU
HOME
PSETH 22.5
FD 60
PD
TT "0
TT "-
PU
FD 6
LT 45 + 22.5
FD 2
PD
TT "|o|
PU
HOME
HT
SETXY [-125 -125]
MAKE "IMG SNAP 250 250
SAVESNAP :IMG "|PolarCoords.bmp|
ERASE :IMG
END
; SHIELD file
TO RIGHTSIDE
RT 55 FD 50
REPEAT 11 [FD 7 LT 5]
FD 80
END
TO RTSHOULDER
REPEAT 4 [BK 20 RT 17.50]
END
TO RTCREST
REPEAT 6 [FD 4 RT 15]
LT 180
REPEAT 6 [FD 4 RT 15]
END
TO LTCREST
REPEAT 6 [RT 15 BK 4]
LT 180
REPEAT 6 [RT 15 BK 4]
END
TO LTSHOULDER
REPEAT 4 [RT 17.50 FD 20]
END
TO LEFTSIDE
BK 80
REPEAT 11 [LT 5 BK 7]
BK 50 RT 55
END
TO LEFTHALF
BK 3
REPEAT 6 [RT 15 BK 4]
LT 180
BK 3 RT 10
REPEAT 5 [RT 15 BK 4]
LT 120
REPEAT 4 [RT 17.50 FD 20]
RT 55
BK 80
REPEAT 11 [LT 5 BK 7]
BK 50 RT 55
END
TO SHIELD
DRAW
PU BK 93 PD
RIGHTSIDE
RT 55
RTSHOULDER
LT 125
RTCREST
LTCREST
LT 125
LTSHOULDER
RT 55
LEFTSIDE
END
SHIELD
; SHIRT file
TO SHIRT
DRAW
PU BK 90 RT 90 PD
FD 70 LT 90
FD 120 RT 90
FD 40 LT 90
FD 60 LT 90
FD 85 LT 90
FD 25 RT 90
FD 50 RT 90
FD 25 LT 90
FD 85 LT 90
FD 60 LT 90
FD 40 RT 90
FD 120 LT 90
FD 70
PU HOME PD
END
SHIRT
Procedure | BEDROOM, BOOKCASE, CAR, CONNECT, FISH, GALAXY, GALAXY2, MAP, MAZE1, MAZE2, MAZE3, POLYGONS, SHIELD, SHIRT |
Description | Files referenced in Logo Works: Lessons in Logo |
Level | Beginner |
Tags | Logo Works |