import "mod_say"
import "mod_video"
import "mod_key"
import "mod_draw"
import "mod_wm"
import "mod_math"
import "mod_map"
function int mb(float p_real, float p_imag,int p_x, int p_y)
private
float l_real;
float l_real_tmp;
float l_imag;
int l_count = 1;
begin
l_real = p_real;
l_imag = p_imag;
while(pow(l_real,2)+pow(l_imag,2) < 4 and l_count < 256)
l_real_tmp = pow(l_real,2)-pow(l_imag,2)+p_real; // 2+3i = 4+2*2*3-9
l_imag = 2*l_real*l_imag+p_imag;
l_real = l_real_tmp;
l_count = l_count + 1;
end;
if (l_count == 256) // bound
put_pixel(p_x,p_y,rgb(0,0,0));
else // unbound
put_pixel(p_x,p_y,rgb(0,l_count,255));
end;
return 1;
end;
process main()
private
float l_start_x = -1.5;
float l_start_y = 0.25;
float l_zoom_level = 0.000625;
int l_size_x = 800;
int l_size_y = 800;
//
float l_real;
float l_imag;
int l_countx;
int l_county;
begin
set_mode(1024,768,16);
l_real = l_start_x;
l_imag = l_start_y;
from l_county = 1 to l_size_y;
from l_countx = 1 to l_size_x;
//say("cnt y " + l_county + "cnt x " + l_countx);
mb(l_real,l_imag,l_countx,l_county);
l_real = l_real + l_zoom_level;
end;
l_real = l_start_x;
l_imag = l_imag - l_zoom_level;
frame(5);
end;
say("complete");
repeat
frame;
until(key(_esc));
end;
|