papert―logo in your browser
examples:
koch snowflake
,
hilbert curve
,
spiral
share this program:
link to it
html:
bbcode:
to branch :sz penwidth (:sz * 0.15) color [0 255 0] forward :sz end to berry :sz penwidth (:sz * 0.3) color [255 0 0] left 30 repeat 3 [forward (:sz * 0.1) right 120] right 30 end to simple :sz :b branch :sz if :b = 1 [berry :sz] penup back :sz pendown end to test :n :sz :b :f ifelse :n = 0 [simple :sz :b] [ make "sz2 :sz / 2 make "n2 :n - 1 make "f2 :f * (0 - 1) test :n2 :sz2 0 :f2 penup forward :sz2 pendown left (:f * :ang1) test :n2 (:scale * :sz2) 1 :f2 right (:f * :ang1) right (:f * :ang2) test :n2 :sz2 :b :f2 left (:f * :ang2) penup back (:sz2) pendown ] end to resetIt clear penup back 220 pendown end make "ang1 45 make "ang2 20 make "scale 0.9 make "scale2 1 resetIt test 5 450 1 1
Your browser doesn't support canvas tags. Please upgrade to a recent version of Firefox or Opera.
<
>