home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d969 / ace.lha / ACE / ACE-2.0.lha / PRGS.lha / Turtle / snowflake.b < prev    next >
Text File  |  1994-01-10  |  836b  |  47 lines

  1. '...fractal snowflake
  2. '...you'll need a stack of about 40000 bytes for this one.
  3.  
  4. sub koch(depth,side)
  5.  if depth = 0 then
  6.    Forward(side)
  7.  else
  8.   koch(depth-1,side\3) : turnLeft(60)
  9.   koch(depth-1,side\3) : turnRight(120)
  10.   koch(depth-1,side\3) : turnLeft(60)
  11.   koch(depth-1,side\3) :
  12.  end if
  13. end sub
  14.   
  15. sub snowflake(depth,side)
  16.  koch(depth,side) : turnRight(120)
  17.  koch(depth,side) : turnRight(120)
  18.  koch(depth,side) : turnRight(120)
  19. end sub
  20.  
  21. window 1,"Fractal Snowflake",(0,0)-(640,250)
  22. color 2,1
  23.  
  24. another$="Y"
  25. while another$="Y"
  26.  cls
  27.  locate 1,1
  28.  input "Enter depth (try 4):   ",depth 
  29.  input "Enter sides (try 250): ",sides 
  30.  
  31.  cls
  32.  
  33.  penup
  34.  setxy 200,225
  35.  pendown
  36.  snowflake(depth,sides)
  37.  
  38.  locate 26,1
  39.  print "another (y/n)?"
  40.  another$=""
  41.  while another$<>"Y" and another$<>"N"
  42.    another$=ucase$(inkey$)
  43.  wend
  44. wend
  45.  
  46. window close 1
  47.