http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Fractals, pretty please?



Hi LogicLord and everyone else who's into fractals,

Here's a QuickBasic program that generates a mandelbrot set.  I think this
is the simplest way to do it.. it runs slow even on my pII 333, but that
might be because it's written in basic :)  I got it out of a magazine many
years ago, so don't ask my how it works.. I can't remember.

I have also attached a more complex version that I found somewhere... it
runs in ega mode.. shouldn't be too hard to convert to vga.  Actually, I
think I did at one stage, but can't seem to find the code.  sorry :)

Here's the simple one:

SCREEN 13
screenwidth = 320
screenheight = 200
zoom = 3.2
xMin = -2
ymin = -1
xMax = xMin + zoom
yMax = ymin + (zoom / screenwidth * screenheight)
ydiv = screenheight / (yMax - ymin)
xDiv = screenwidth / (xMax - xMin)
FOR y = 0 TO screenheight / 2 - 1
    FOR x = 0 TO screenwidth - 1
        ox = (x / xDiv) + xMin
        oy = (y / ydiv) + ymin
        bx = 0
        by = 0
        FOR b = 1 TO 256
            x2 = bx * bx
            y2 = by * by
            j = x2 + y2
            k = x2 - y2
            by = 2 * bx * by + oy
            bx = k + ox
            IF j > 4 THEN EXIT FOR
        NEXT
    IF b < 256 THEN
        PSET (x, y), b
        PSET (x, screenheight - y - 1), b
    ELSE
        PSET (x, y), 1
        PSET (x, screenheight - y - 1), 1


    END IF

    NEXT
NEXT



There is also a freeware program called Fractint.  There was a windows
version at one stage, but I don't have it on my computer.  I have taken the
liberty of putting my dos version zipped on to the net... it's at

http://members.xoom.com/Telerei/fractint.zip


it is 574kb

Fractint explains how a large number of fractals work (I think.. it's in
help I'm sure)  and it allows you to zoom in, play with the colours,
parameters and other fun stuff.

sorry about the attachment.. this time it actually has something useful in
it.

happy coding :)



> -----Original Message-----
> From: gameprogrammer-owner@gameprogrammer.com
> [mailto:gameprogrammer-owner@gameprogrammer.com]On Behalf Of legacy
> Sent: Thursday, September 09, 1999 2:14
> To: gameprogrammer@gameprogrammer.com
> Subject: Fractals, pretty please?
>
>
> Folks,
>
>  Not to GRIPE or anything.  I'm sure you all have busy busy schedules
> and all, but if any of you knows even the tiniest little thing about
> fractals and has a few little programs, preferably in QBasic or
> something equally as archaic, I would greatly appreciate it.  And I'll
> even help the winner out with any questions he/she has, as I am fluent
> in pretty much all other mathematics excluding fractals.  Thanks again.
> You people are the best.
>
> LogicLord
>
> =================================================================
> To SUBSCRIBE or UNSUBSCRIBE please visit
> http://gameprogrammer.com/mailinglist.html
>

MANDEL.BAS