'Buddhabrot by Antoni Gual 6/2003 agual@eic.ictnet.esB
'------------------------------------------------------------------------------
'This different rendering of the Mandelbrot Set, created by Melinda Green
' reminds the shape of the classic sculpture of the sitting Buddha.
'-----------------------------------------------------------------------------
'The number of calculations needed to obtain this shape is much bigger than
' for classic mandelbrot set.The complete drawing can take hours
'Good news is you can divide time needed by 5
' if you load qb with ffix library, a patch by V1ctor for the QB slow floting
' point operations. You can find ffix in my site among many others.
' www.geocities.com/antonigual/qbasic
'
' You must uncomment the two lines invokking ffix,then call qb with:
' c:\qbpath\qb budabrot.bas /lc:\qbpath\ffix
'-----------------------------------------------------------------------------
'Classic Mandelbrot is drawn by plotting the points in the complex plane where
'the Mandelbrot formula leads to a convergent series.
'
'The BuddhaBrot is drawing by cumulating all intermediate points of the
'diverting Mandelbrot series.
'----------------------------------------------------------------------------
'Two sites about Mandelbrot and its variants:
'http://mandelbrot.dazibao.free.fr/ 'Mandelbrot Set in QB
'http://www.superliminal.com/fractals/bbrot/bbrot.htm 'Melinda Green's site
'
'Have Fun!...E-mail me yor improvements on this program..
'------------------------------------------------------------------------------
'If you are using ffix, uncomment the next two lines to boost speed x 5
''DECLARE SUB ffix
''ffix
'set palette made of shades of green
temp = c / 4
'plus awhite color for the time display
'If you increase niter you will have a crisper but slower rendering
'set up arrays to save intermediate points
'seed the mandelbrot series with random points of complex plane
im = 0: re = 0: re2 = 0: im2 = 0
diverts% = 0
'iterate the mandelbrot formula
im = 2 * re * im + x
re = re2 - im2 + y
'Save the intermediate points of the series to arrays
'IF re > 1E+21 THEN EXIT FOR
'IF im > 1E+21 THEN EXIT FOR
real(iter%) = re
imag(iter%) = im
im2 = im * im
re2 = re * re
'If the seed point leads to a diverting series, we are interested
'Plot to screen the points of the DIVERGENT series
xs%
= CINT(imag
(it%
) * 80) + 160 ys%
= CINT(real
(it%
) * 80) + 120
'To display rendering time, not really needed