Julie Clune writes: << I would love to try out your Fractal tree, but I can't work out how I can MicroWorldise your Fractal Tree. What do I do with define? Do I need it? I don't need for it to stay in a one-liner form. I would just like to see it work. >> "define" is used to define a procedure. You can use "to" instead. (In MicroWorlds, click the "to" button.) For example, this: define "square [[side] [fd :side rt 90]] is the same as this: to square :side fd :side rt 90 end The difference is that "define" can be used as a command within a Logo program, whereas "to" requires you to use the editor. For the one-liner contest, you can use "define" to define a procedure and run it, all on the same line. Fractal Tree: define "t [[x] [if :x > 1 [t :x*.6 rt 60 t :x*.6 fd :x]]] t 200 is the same as defining this procedure: to t :x if :x > 1 [t :x*.6 rt 60 t :x*.6 fd :x] end and then running the procedure: t 200 (Notice that "t" runs itself (twice). It is "recursive".) << Also, what does reset do? Is there an alternative command in MW I could use, or can I do without it? >> You do not need "reset". I typically make a procedure named "reset" to reset everything which I have been messing with. At a minimum, "reset" means go home and clear the screen. Also it may show or hide the turtle, put the pen down, reset the pen size and color, reset the background color, etc. - Keith Enevoldsen --------------------------------------------------------------- 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