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