Program draws mandala image
Delphi & Pascal (česká wiki)
Category: KMP (Club of young programmers)
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Mandel2.pas
File exe: Mandel2.exe
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Mandel2.pas
File exe: Mandel2.exe
Program draws mandala image.
{ MANDEL2.PAS } { Program vykresli mandelov obrazec. } { } { Datum:04.10.1994 http://www.trsek.com } uses crt; const XMax=160; YMax=100; var cc:char; var X,Xbe,Y:integer; dim,dre,Yb,Ye,Xb,Xe:real; var Z,Z1,C:record Re,Im:real; end; Krok:integer; PROCEDURE Mandel; var p,e:^byte; begin dre:=(Xe-Xb)/XMax; dim:=(Ye-Yb)/YMax; p:=ptr($0a000,0); C.Im:=Yb; while C.Im>=Ye do begin e:=p; C.Re:=Xb; while C.Re<=Xe do begin Z.Re:=0; Z.Im:=0; Krok:=0; repeat Z1.Re:=Z.Re*Z.Re-Z.Im*Z.Im +C.Re; {Z[i+1]:=Z[i]*Z[i] + C} Z.Im:=2*Z.Re*Z.Im +C.Im; Z.Re:=Z1.Re; inc(krok); until (krok>50) or (Abs(Z.Re*Z.Re+Z.Im*Z.Im)>4); p^:=15+krok mod 100; 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:=2; Ye:=-2; 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.