home *** CD-ROM | disk | FTP | other *** search
- '...fractal snowflake
- '...you'll need a stack of about 40000 bytes for this one.
-
- sub koch(depth,side)
- if depth = 0 then
- Forward(side)
- else
- koch(depth-1,side\3) : turnLeft(60)
- koch(depth-1,side\3) : turnRight(120)
- koch(depth-1,side\3) : turnLeft(60)
- koch(depth-1,side\3) :
- end if
- end sub
-
- sub snowflake(depth,side)
- koch(depth,side) : turnRight(120)
- koch(depth,side) : turnRight(120)
- koch(depth,side) : turnRight(120)
- end sub
-
- window 1,"Fractal Snowflake",(0,0)-(640,250)
- color 2,1
-
- another$="Y"
- while another$="Y"
- cls
- locate 1,1
- input "Enter depth (try 4): ",depth
- input "Enter sides (try 250): ",sides
-
- cls
-
- penup
- setxy 200,225
- pendown
- snowflake(depth,sides)
-
- locate 26,1
- print "another (y/n)?"
- another$=""
- while another$<>"Y" and another$<>"N"
- another$=ucase$(inkey$)
- wend
- wend
-
- window close 1
-