[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> hilbert again, but not quite



; I made this in MSWLogo.
; To draw the curve try 
; m 4 
; It was a problem in a 
; chapter of a book that
; talked about Hilbert
; and Sierpinski curves
; Is there an easier way
; to solve it?

to ca :n
if :n=0 [stop]
ca :n-1
cbc :n-1
r
cd :n-1
cac :n-1
d
end

to cac :n
if :n=0 [stop]
u
ca :n-1
cbc :n-1
r
cd :n-1
cac :n-1
end

to cb :n
if :n=0 [stop]
cb :n-1
ccc :n-1
d
ca :n-1
cbc :n-1
l
end

to cbc :n
if :n=0 [stop]
r
cb :n-1
ccc :n-1
d
ca :n-1
cbc :n-1

end

to cc :n
if :n=0 [stop]

cc :n-1
cdc :n-1
l
cb :n-1
ccc :n-1
u

end

to ccc :n
if :n=0 [stop]

d
cc :n-1
cdc :n-1
l
cb :n-1
ccc :n-1

end

to cd :n
if :n=0 [stop]

cd :n-1
cac :n-1
u
cc :n-1
cdc :n-1
r

end

to cdc :n
if :n=0 [stop]

l
cd :n-1
cac :n-1
u
cc :n-1
cdc :n-1

end

to m :n
make "pila []
ca :n
r
cb :n
d
cc :n
l
cd :n
u
end

to r ; right
seth 90
fd :len
end

to u ; up
seth 0
fd :len
end

to d ; down
seth 180
fd :len
end

to l ; left
seth -90
fd :len
end

Make "len 10
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home