Program draws Mandel image
Delphi & Pascal (česká wiki)
Category: KMP (Club of young programmers)
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Mandel.pas
File exe: Mandel.exe
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Mandel.pas
File exe: Mandel.exe
Program draws Mandel image.
{ MANDEL.PAS } { Program vykresli mandelov obrazec. } { } { Datum:09.10.1994 http://www.trsek.com } uses crt; const XMax=320; YMax=200; var cc:char; var X,Xbe,Y:integer; dim,dre,Yb,Ye,Xb,Xe:real; var Co,Z,Z1,C:record Re,Im:real; end; Krok:integer; PROCEDURE Mandel; var p,e:^byte; max,min:real; begin dre:=(Xe-Xb)/XMax; dim:=(Ye-Yb)/YMax; p:=ptr($0a000,0); Co.Re:=0.3; Co.Im:=0.6; max:=0; min:=0; C.Im:=Yb; while C.Im>=Ye do begin e:=p; C.Re:=Xb; while C.Re<=Xe do begin Z.Re:=C.Re; Z.Im:=C.Im; Krok:=0; while not((krok>64) or ((Z.Re*Z.Re+Z.Im*Z.Im)>=4)) do begin Z1.Re:=Z.Re*Z.Re-Z.Im*Z.Im +Co.Re; {Z[i+1]:=Z[i]*Z[i] + C} Z.Im:=2*Z.Re*Z.Im +Co.Im; Z.Re:=Z1.Re; if Z.Re>max then max:=Z.Re; if Z.Re<min then min:=Z.Re; if Z.Im>max then max:=Z.Im; if Z.Im<min then min:=Z.Im; inc(krok); end; p^:=krok mod 100; dec(p^); inc(p); C.Re:=C.Re+dre; end; C.Im:=C.Im+dim; p:=e; inc(p,320); end; end; begin asm mov ax,0013h int 10h end; Y:=0; Xbe:=0; Yb:=1.5; Ye:=-1.5; Xb:=-2; Xe:=2; Mandel; cc:=readkey; { Y:=0; Xbe:=40; Yb:=-0.5; Ye:=-0.4; Xb:=-0.35; Xe:=0.15; Mandel; cc:=readkey;} { Xb:=0.2286305064; Xe:=0.237024009; Ye:=-0.553911055; Yb:=-0.547616189; Mandel; cc:=readkey;} { Y:=0; Xbe:=0; Ye:=-1.12; Yb:=-0.84; Xb:=-0.2375; Xe:=0.0375; Mandel; cc:=readkey;} end.