This is the core function. The rest of the code apparently displays the code next to the drawing as it runs using some specific UCBLogo text based commands. You can easily port it to MSWLogo if you like. Note "Step" and/or "Trace" can do much of what I think it did. I could not get it to run properly even in UCBLogo. Wrap problems maybe and uninitialized variables which I guessed at. I got it partially working in UCBLogo but one error kept on scrolling off the text window. But I think I got far enough to get the idea. to tree :number :size if :number=0 [stop] fd :size/3 lt 20 tree :number-1 :size*0.7 rt 20 fd :size/6 rt 25 tree :number-1 :size*0.55 lt 25 fd :size/2 lt 30 tree :number-1 :size*0.2 rt 50 tree :number-1 :size*0.25 lt 20 bk :size end to treedemo tree 5 150 end LoriLamp@aol.com wrote: > > It didn't run in MSWLogo -- any hope of one of you geniuses "transposing" it > for me? > > Lori > > ***************************** > to teach > localmake "globals [] > localmake "varposn [-300 -120] > localmake "depthcolors [6 1 4 14 2 8 13 9] > localmake "stepfast "false > clearscreen > wait 60 > catch "picture [flagdemo] > clearscreen > catch "picture [treedemo] > end > > to treedemo > localmake "varposn [0 -120] > hideturtle > pendown setpencolor 7 > tree 5 150 > showturtle > catch "demo [user] > demo [tree 1 150] > demo [tree 2 150] > demo [tree 3 150] > end > > to flagdemo > hideturtle > pendown setpencolor 7 > flags 15 22 1 43 1 > showturtle > catch "demo [user] > demo [flag] > demo [fillflag 4] > demo [flags 15 22 1 5 1] > end > > to user > if :stepfast [wait 20 stop] > pr [Press spacebar to continue, F to continue Fast (without asking each > step),] > type [D to skip to next Demo, or P for a different Picture:\ ] > localmake "char uppercase readchar > cleartext > if :char = "F [make "stepfast "true] > if :char = "D [throw "demo] > if :char = "P [throw "picture] > end > > to demo :command > clearscreen > type "|? | > settextcolor 6 0 > print :command > settextcolor 7 0 > run :command > display first :command > catch "demo [ > user > clearscreen > localmake "linecolors map [(list 0 7)] butfirst text first :command > localmake "walkdepth 0 > walk :command > ] > make "stepfast "false > end > > to display :procname > localmake "oldpos pos > localmake "oldheading heading > localmake "text fulltext :procname > localmake "height 180 > foreach :text [ > penup setpos list -300 :height setheading 0 > make "height :height-18 > pendown label ? > ] > penup setpos :oldpos setheading :oldheading pendown > end > > to walk :command [:dpy "true] [:walkdepth :walkdepth+1] > localmake "stepfast :stepfast > localmake "text text first :command > localmake "fulltext fulltext first :command > localmake "oldvalues map [ifelse namep ? [thing ?] ["none]] first :text > localmake "variables first :text > local :variables > (foreach :variables :oldvalues "make) > local "values > run (sentence "make ""values "\( "list butfirst :command "\) ) > (foreach :variables :values "make) > if :dpy [display first :command] > showvariables > commands butfirst :text butfirst :fulltext 180-18 :linecolors > end > > to commands :text :fulltext :height :somecolors > if empty? :text [stop] > localmake "pos pos > localmake "head heading > localmake "pen pendown? > localmake "pc pencolor > penup setpos list -300 :height setheading 0 > setpencolor item :walkdepth :depthcolors > pendown label first :fulltext > .setbf first :somecolors fput pencolor butfirst first :somecolors > penup setpos :pos setheading :head > if :pen [pendown] > setpencolor :pc > if equalp first first :text "localmake [ > run sentence first :text [] > ] > localmake "runresult runresult [commands1] > if emptyp :runresult [user] > make "pos pos > make "head heading > make "pen pendown? > make "pc pencolor > penup setpos list -300 :height setheading 0 > .setbf first :somecolors butfirst butfirst first :somecolors > setpencolor first butfirst first :somecolors > pendown label first :fulltext > penup setpos :pos setheading :head > if :pen [pendown] > setpencolor :pc > if emptyp :runresult [stop] > if not equalp first :runresult "command-completed-without-stopping ~ > [output first :runresult] > commands butfirst :text butfirst :fulltext :height-18 butfirst :somecolors > end > > to commands1 > ifelse equalp first first :text first :command ~ > [(walk sentence first :text [] "false) > if not emptyp butfirst :text [showvariables]] ~ > [run sentence first :text [] > if equalp first first :text "make [walkmake "globals] > if equalp first first :text "localmake [walkmake "variables] > user] > output "command-completed-without-stopping > end > > to walkmake :varlist > local "makevalues > run (sentence "make ""makevalues "\( "list butfirst first :text "\) ) > localmake "varname first :makevalues > if not memberp :varname (sentence :globals :variables) ~ > [make :varlist sentence thing :varlist :varname] > showvariables > end > > to showvariables > localmake "oldpos pos > localmake "oldheading heading > localmake "oldpc pencolor > penup setpos :varposn setheading 0 pendown > foreach (sentence :globals :variables) ~ > [setpc 7 label (word ? "=) > penup right 90 forward 10*(1+count ?) left 90 pendown > setpc item :walkdepth :depthcolors label (list thing ? "| |) > penup right 90 forward 30 left 90 pendown] > penup setpos :oldpos setheading :oldheading pendown setpc :oldpc > end > > to flag > forward 100 > localmake "p pos > back 32 > right 90 > forward 24 > left 90 > setpos :p > end > > to fillflag :color > flag > penup back 20 right 90 forward 5 > setpencolor remainder :color 16 > fill > setpencolor 7 > back 5 left 90 back 80 pendown > end > > to flags :distance :angle :increment :number :fillcolor > if :number=0 [stop] > fillflag :fillcolor > forward :distance > right :angle > flags :distance+:increment :angle :increment :number-1 :fillcolor+1 > end > > to tree :number :size > if :number=0 [stop] > fd :size/3 > lt 20 > tree :number-1 :size*0.7 > rt 20 > fd :size/6 > rt 25 > tree :number-1 :size*0.55 > lt 25 > fd :size/2 > lt 30 > tree :number-1 :size*0.2 > rt 50 > tree :number-1 :size*0.25 > lt 20 > bk :size > 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. -- =============================================================== George Mills (mills@softronix.com) http://www.softronix.com/ The www page contains some very powerful educational software. Our single most important investment is our kids. --------------------------------------------------------------- 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