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

Re: LOGO-L> hilbert again, but not quite




fajoy@uio.satnet.net wrote:

; 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?

[snip]

This figure (invented by Mr Niklaus Wirth - creator of Pascal programming
language) was shown on logo list some time ago. 
Your solution is very similar to that used by Niklaus Wirth in his book
"Algorithms + Data Structures = Programs"
 But N.Wirth didn't use turtle graphic. In fact he use no really graphic
commands at all. There were only virtual "plot" and "setpen" commands  -
something like setpos in Logo.

My favorite way of drawing "W" figure is as follows:

;type
;  w.figure 3 10
;to obtain the same picture as Yours

to w.figure :k :b
 repeat 4 [w.angle w.connect :k]
end

to w.angle
 rt 90 fd :b lt 90 fd :b rt 90
end

to w.connect :k
 if :k=0 [fd :b stop]
 w.connect :k-1
 w.angle
 w.connect :k-1
 lt 90 fd :b lt 90
 w.connect :k-1
 w.angle
 w.connect :k-1
end



---------------------------------------------------------------
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