Qbasicnews.com

Full Version: Buddahbrot fractal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
It's in Jark's page but his QB program is in hi-res and takes ages to run. So I made a lo-res screen 13 version.
If you use ffix you will have a decent image in ten minutes.
It's just a differnet view of the Mandelbrot fractal. Melissa Green found it . http://www.superliminal.com/fractals/bbrot/bbrot.htm

Code:
'Buddahbrot fractal by Antoni Gual
'If you are using ffix, uncomment the next two lines to boost speed x 5
'DECLARE SUB ffix
'ffix
SCREEN 13
RANDOMIZE TIMER
OUT &H3C8, 0
FOR i% = 0 TO 255
OUT &H3C9, 0
OUT &H3C9, i% \ 4
OUT &H3C9, 0
NEXT
COLOR 255

CONST niter = 10000

REDIM real(niter)
REDIM imag(niter)
t! = TIMER

DO
  x = 4 * RND - 2
  y = 4 * RND - 2
  diverts% = 0
im = 0: re = 0: re2 = 0: im2 = 0

FOR iter% = 0 TO niter
  im = 2 * re * im + x
  re = re2 - im2 + y
  real(iter%) = re
  imag(iter%) = im
  im2 = im * im
  re2 = re * re
  IF re2 + im2 > 4 THEN diverts% = 1: EXIT FOR
NEXT
  'plot the points of the diverting values
  IF diverts% THEN
    FOR it% = 0 TO iter%
        xx% = CINT(ABS(imag(it%) * 97))
        xs% = xx% + 160
        ys% = CINT(real(it%) * 97) + 150
        pp% = POINT(xs%, ys%)
        IF pp% < 255 AND pp% > -1 THEN PSET (xs%, ys%), pp% + 1: PSET (160 - xx%, ys%), pp% + 1
    NEXT
    np% = (np% + 1) AND &HFF
    IF np% = 0 THEN LOCATE , 1: PRINT USING "####.#"; TIMER - t!;
   END IF
LOOP UNTIL LEN(INKEY$)
END
If you liked it go to Jark's page, find the hi-res program and wait all night for a real good image in a bmp file.
Ya, I did that for my math project Wink
Cool *gets a cup of coffee* *waits* *finishes cup* *goes to work* *comes back*

hey, it's done! Smile
How long does it take? I left it for ages (until 9500 in top left). It was turning into a blob...
If i compile it with ffix, i get a correct image in 5 minutes. In the IDE and not compiled it should take 30 minutes. The counter is in seconds.

The program does'nt have a stop condition and keeps increasing the color number of the pixels untill they are all at color 255.Tongue

So you probably patiented too much... : Big Grin
Aah.

Also, I have a cold, so had brightness down to 0 and contrast to 50, so it emerged as a blob. :roll:
You're now part of the very small club of the Buddhabrot makers :lol:

You may send your code to Melinda, I think you made the only fast program for a Buddhabrot: it can take several days to get a hi-res pic !

The funny thing when I made my first Buddhabrot is that Melinda (who was still a man then, she was named Daniel until last summer) and Lori were the only two who knew this trick... I decided I would try, and managed to understand the mysterious explanation on her webpage.

Then a polish guy asked on sci.fractals if someone knew the algorithm... I was just finishing my first prog! I posted the code on my site, and that's when it all started... Paul Bourke himself issued Buddhabrots, and I've been lucky enough to get my name in the Encyclopedia of the Mandelbrot set by Robert Munafo.

And that funny story proved one thing : if you want anybody to understand an algorithm, the best language to code it is Quick-Basic!
I was thinking Melissa would be a nice person until i saw she has he page of the Bonsai Kitten as one of her bookmarks. :barf:

So i prefer not to have any relation with her...
The problem being it is not a joke !

Well, I managed to find the old Daniel Green page (it's not linked from the main site any longer, but Google still knows it).

It's quite funny to compare the "before" (Daniel) and after "Melinda" pictures...
Quote:I was thinking Melissa would be a nice person until i saw she has he page of the Bonsai Kitten as one of her bookmarks. :barf:

So i prefer not to have any relation with her...

Oh my god I didn't know what it was so I visited the Bonsai Kitten page... This is one of the most horrible things I can think of! How can people be that evil? Sincerely I'm very impressed. That should be punished with jail. Is that legal?
Pages: 1 2