home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 91 / af091a.adf / af91a3.lzx / prgs / Fractals / sierp.b < prev    next >
Text File  |  2018-11-22  |  469b  |  39 lines

  1. '...Sierpinski Triangle
  2.  
  3. screen 1,320,200,1,1
  4.  
  5. palette 0,0,0,0
  6. palette 1,1,1,1
  7.  
  8. color 1,0
  9. cls
  10.  
  11. randomize timer
  12.  
  13. '...Triangle corners...
  14.  
  15. dim xx%(4),yy%(4)
  16.  
  17. for i=1 to 3
  18.   read xx%(i),yy%(i)
  19. next
  20.  
  21. data 70,20,250,20,160,190
  22.  
  23. '..initial x,y
  24. X%=160
  25. Y%=20
  26.  
  27. while not mouse(0)
  28.   posn%=INT(RND*3.0) + 1
  29.   '..arithmetic right shift is 
  30.   '..faster than integer division
  31.   X% = shr((X% + xx%(posn%)),1&)
  32.   Y% = shr((Y% + yy%(posn%)),1&)
  33.   PSET (X%,Y%)
  34. wend
  35.  
  36. screen close 1
  37.  
  38. end
  39.