Mandelbrot
Posted: Mon Jul 28, 2014 3:27 pm
Hello,
Code: Select all
SCREEN 800, 600
Global x#, y#, zx#, zy#, cx#, cy#, tp#
Global im, z, it
im=570: z=150
h = ScreenHeight()
w = ScreenWidth ()
Text 200,200,"WAIT A MOMENT...."
DrawScreen
Lock
For y=0 To h-1
For x=0 To w-1
zx=0
zy=0
cx= (x-400)/z
cy= (y-300)/z
it = im
While zx * zx + zy * zy < 4 And it>0
tp = zx * zx - zy * zy + cx
zy = 2 * zx * zy + cy
zx = tp
it = it-1
Wend
PutPixel2 x,y, RGB(it*12,it*8,it*4)
Next x
Next y
Unlock
DrawScreen
WaitKey
Function RGB(r0, g0, b0)
g0=g0*256: r0=r0*65536
Return r0+g0+b0
End Function