RosettaCodeData/Task/Mandelbrot-set/FutureBasic/mandelbrot-set.basic

43 lines
936 B
Plaintext

_xmin = -8601
_xmax = 2867
_ymin = -4915
_ymax = 4915
_maxiter = 32
_dx = ( _xmax - _xmin ) / 79
_dy = ( _ymax - _ymin ) / 24
void local fn MandelbrotSet
printf @"\n"
SInt32 cy = _ymin
while ( cy <= _ymax )
SInt32 cx = _xmin
while ( cx <= _xmax )
SInt32 x = 0
SInt32 y = 0
SInt32 x2 = 0
SInt32 y2 = 0
SInt32 iter = 0
while ( iter < _maxiter )
if ( x2 + y2 > 16384 ) then break
y = ( ( x * y ) >> 11 ) + (SInt32)cy
x = x2 - y2 + (SInt32)cx
x2 = ( x * x ) >> 12
y2 = ( y * y ) >> 12
iter++
wend
print fn StringWithFormat( @"%3c", iter + 32 );
cx += _dx
wend
printf @"\n"
cy += _dy
wend
end fn
window 1, @"Mandelbrot Set", ( 0, 0, 820, 650 )
WindowSetBackgroundColor( 1, fn ColorBlack )
text @"Impact", 10.0, fn ColorWithRGB( 1.000, 0.800, 0.000, 1.0 )
fn MandelbrotSet
HandleEvents