Академический Документы
Профессиональный Документы
Культура Документы
K: ; !' wM I * if |l m m
Chapter 14
POLY 30 90
The turtle does not stop because p o l y keeps tell ing it to go forward and turn. To stop p o l y and the turtle press c t r l - g . Logo responds
STOPPED!
You probably will want to clear the screen (cs). Here are some suggestions for exploring p o l y . You will no doubt want to try other inputs, too.
>
97
&
30 144 3 0 40 30 160
is recursive. That is, instead of calling an other procedure to help out, p o l y calls itself. This is a simple example of recursion. We will meet other examples later.
p o ly
Turtle Draws Arcs Many projects require only pieces of circle. In those cases you can use the commands a r c r i g h t ( a r c r ) and a r c l e f t ( a r c l ) . These procedures need 2 inputs: the first input is the radius of the circle from which the arc is taken and the second input is the number of degrees of the arc.
r
ARCR ARCR 30 30 90 90
Bug Box If Logo does not know how to a r c r or a r c l skip the rest of this chapter. Appendix A offers an ex planation of why Logo might not know how to do these procedures. Clear the screen and try some other inputs.
98!
ARCL 4 0 1 2 0 LT 1 2 0 ARCL 4 0 1 2 0
A Fish!
r r & 0
ARCR 4 0 9 0 RT 9 0 ARCR 4 0 9 0 RT 9 0
Try
PETAL REPEAT REPEAT 453 40 8 4 PETAL [PETAL [PETAL 30 40 30 PETAL RT 4 5 30 RT 45] 40 RT !
PETAL
Notice that Logo lines can extend beyond one screen line. Logo marks continuation lines by put ting a ! (exclamation point) in the last character position of the line. The rest of the text flows onto the next screen line. You might want to make a f l o w e r out of one of these designs. Now lets do a s w a n .
99
I!
% >
>
1
i i I I ;
SWAN
U3E-A D
ne c k
BODY
There are really only' 2 (Afferent shapes, mT.*x and nkcit. Vfe can use p r ta l to make ody ar.n
W&A&. to. &a&y H 45 T
M 45 i>!TA4 JSIZE
E-M
1 > ( o
TO m iK iS rz-E: i f 45
A-ffSft i S I Z i
fcf 45
A C - JfZE 90 RH
TO KEAl>
> < o
PETM ; SIZE:
LT 135
E 'D ^ '
!z e i
RT 135
100