0% found this document useful (0 votes)
83 views

A First Project: Drawing A Spider

This document provides instructions for using Logo programming to draw a spider with 8 legs. It describes how to write procedures for a right leg ("RIGHTLEG"), left leg ("LEFTLEG"), the right side with 4 right legs ("RIGHTSIDE"), and the left side with 4 left legs ("LEFTSIDE"). Putting it all together, a final "SPIDER" procedure is created to draw the full spider by calling the right and left side procedures and moving the turtle forward and back.

Uploaded by

Cynthia Solomon
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

A First Project: Drawing A Spider

This document provides instructions for using Logo programming to draw a spider with 8 legs. It describes how to write procedures for a right leg ("RIGHTLEG"), left leg ("LEFTLEG"), the right side with 4 right legs ("RIGHTSIDE"), and the left side with 4 left legs ("LEFTSIDE"). Putting it all together, a final "SPIDER" procedure is created to draw the full spider by calling the right and left side procedures and moving the turtle forward and back.

Uploaded by

Cynthia Solomon
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

A First Project: Drawing a Spider

A First Project: Drawing a Spider


Lets make a spider like this one; it has 4 legs on each side. A first step is to look more closely at a right leg and a left leg. Each leg is made by 2 lines joined to form a 90 degree angle. As a first step lets make a r
TO R I G H T L E G FD 3 0 RT 9 0 FD 3 0 END
ig h t l e g

You can choose any number as input to f o r w a r d . We use 30 here.

Now type
RIGHTLEG

Although this procedure makes a leg, the turtle stops at a funny place for making another spider leg. At this point stairs.
r ig h t l e g

could be used to make

RIGHTLEG LT 9 0 RIGHTLEG LT 9 0 RIGHTLEG

... but we want spider legs. When in doubt about where you think the turtle should be when the procedure stops, put the tur tle where it was before the procedure was run. Now fix or debug r i g h t l e g using the editor.
EDIT "RIGHTLEG

( r ( I Now the Logo editor shows this procedure with the I (cursor) on the t of t o .
TO R I G H T L E G FD 3 0 RT 9 0 FD 3 0 END

Now type in the new commands.


TO R I G H T L E G FD 3 0 RT 9 0 FD 3 0 BK 3 0 LT 90 BK 3 0 END

These next 3 commands return the turtle to where it was at the start of r i g h t l e g .

Try
i ' ; ' T

RIGHTLEG.

RIGHTLEG

Now plan r i g h t s i d e , the procedure which will draw all the legs on the spiders right side. We want one leg horizontal, so ...
CS

R IG H T L E G

RT

90

RIGHTLEG

68

Now for the second leg .

LT

20

RIGHTLEG

Good. Continue in this way until the turtle has drawn 4 legs. You can now make a procedure for
RIGHTSIDE.
TO R I G H T S I D E RT 9 0 REPEAT 4 [RIGHTLEG LT 1 0 END

LT

20]

Notice the last command in r i g h t s i d e , l t 1 0 , re turns the turtle to the same position and heading it was in at the start of the procedure. It is good practice to force procedures to adopt the rule of good behavior: Leave the turtle in the state you found it. Now work on a left leg. l
RIGHTLEG.
e f t l e g

will be similar to

TO L E F T L E G FD 3 0 LT 9 0 FD 3 0 BK 3 0 RT 9 0 BK 3 0 END

Try it out. Use

l e f t l e g

to write l

e f t s id e

TO L E F T S I D E L E F T 90 REPEAT 4 [LE FT LEG RT 1 0 END

RT

20]

and finally...
TO S P I D E R LEFTSIDE RIGHTSIDE FD 1 0 BK 1 0 HT END

H ID E T U R T L E n o w is d o n e.

t h a t th e jo b

Other Designs Using

r ig h t l e g

and l

e f t l e g

MAN

You might also like