|
snowflake.tur
(define CreatedByGregReshko 0)
(turtle {800 600})
(define (selectcolor:color {iteration:int t:int})
(
if (= {0 iteration}) green
(
if (= {1 iteration}) blue
(
if (= {2 iteration}) red
(
if (= {3 iteration}) cyan
(
if (= {4 iteration}) magenta green
)
)
)
)
)
)
(define (snowflake:unit {maxiter:int current:int rotate:int size:int})
(if (= {current maxiter})
()
(begin
( pendown () )
( pencolor (selectcolor {(- {current 1}) 1}) )
( forward (/ {size 2}) )
( snowflake {maxiter (+ {current 1}) 4 (if (= {current 0}) (/ {(* {size
2}) 5}) (/ {size 3})) } )
( penup () )
( backward (/ {size 2}) )
( left 72 )
( if (= {rotate 0}) () (snowflake {maxiter current (- {rotate 1}) size}) )
( right 72 )
)
)
)
(pendown ())
(pencolor black)
(snowflake {6 0 4 200})
|