Category : Printer + Display Graphics
Archive   : MAND1.ZIP
Filename : MANDEL.PAS
Output of file : MANDEL.PAS contained in archive : MAND1.ZIP
Written By Dave Durant and Charles Sutton.}
program DCMandel;
uses crt, graph;
var
maxIters, x, y : longint;
minx, maxx, miny, maxy : single;
gd, gm : integer;
colorscale : single;
tdebug : single;
function scaley(y: integer): single;
begin scaley := (y*(maxy-miny)/(getmaxy))+miny; end;
function scalex(x: integer): single;
begin scalex := (1.5*x*(maxx-minx)/getmaxx)-maxx; end;
function iter (rC, iC: single; mIters : longint) : longint;
var
Iters : longint;
rTmp, iTmp, rCalc, iCalc : single;
begin
rTmp := 0;
iTmp := 0;
for Iters := 1 to mIters do
begin
rCalc := rTmp*rTmp - iTmp*iTmp; { function from here }
iCalc := 2*rTmp*iTmp;
rTmp := rCalc + rC;
iTmp := iCalc + iC; { to here }
tdebug := sqrt(rTmp*rTmp + iTmp*iTmp);
if sqrt(rTmp*rTmp + iTmp*iTmp) > 2 then begin
iter := Iters;
exit;
end;
end;
iter := 0;
end;
procedure do_graph;
var
stuff : longint;
{ x1, y1 : real;}
begin
initgraph(gd, gm, 'c:\tp\bgi');
colorscale := getmaxcolor/25;
for x := 0 to getmaxx do begin
for y := 0 to trunc(getmaxy/2) do begin
{ x1 := scalex(x); y1 := scaley(y)}
stuff := iter(scalex(x), scaley(y), maxiters);
putpixel(x, y, trunc((stuff*colorscale)+0.5));
putpixel(x, getmaxy-y, trunc((stuff*colorscale)+0.5));
end;
end;
readln;
closegraph;
end;
begin
closegraph;
write('Maximum iterations: ');
readln(maxIters);
write('Min x, max x: ');
readln(minx, maxx);
write('Min y, max y: ');
readln(miny, maxy);
do_graph;
end.
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/