home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 91 / af091a.adf / af91a3.lzx / prgs / Turtle / spiro.b < prev    next >
Text File  |  2019-01-20  |  756b  |  55 lines

  1. '...SpiroGraph
  2.  
  3. defint a-z
  4.  
  5. const true = -1&, false = 0&
  6.  
  7. window 1,"SpiroGraph",(0,0)-(640,400),6     '..good for productivity mode on A1200
  8.  
  9. font "topaz",8
  10.  
  11. menu 1,0,1,"Project"
  12. menu 1,1,1,"Quit","Q"
  13. on menu gosub quit
  14. menu on
  15.  
  16. color 2,1
  17. cls
  18.  
  19. sub poly(sides,length)
  20.   for i=1 to sides
  21.     forward length
  22.     turnright 360\sides
  23.   next
  24. end sub
  25.  
  26. sub spiro(sides,length)
  27.   repeat
  28.     poly(sides,length)
  29.     turnright 360\sides
  30.     penup
  31.     setxy 320,200
  32.     pendown
  33.   until false
  34. end sub
  35.  
  36. '..main
  37. locate 2,1
  38. input "How many sides per polygon? (eg. 9)  ",sides
  39. input "Length of each side?        (eg. 30) ",length
  40. cls
  41.  
  42. penup
  43. setxy 320,200
  44. pendown
  45.  
  46. spiro(sides,length)
  47.  
  48. while true
  49. wend
  50.  
  51. quit: 
  52.   if menu(0) <> 1 or menu(1) <> 1 then return 
  53.   window close 1
  54. END
  55.