Program draws Mandel image
Delphi & Pascal (česká wiki)
Category: KMP (Club of young programmers)
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Mandel3.pas
File exe: Mandel3.exe
Author: Ján Benkovič
web: www.tbteacher.host.sk
Program: Mandel3.pas
File exe: Mandel3.exe
Program draws Mandel image.
{ MANDEL3.PAS } { Program vykresli mandelov obrazec. } { } { } { Datum:09.10.1994 http://www.trsek.com } uses crt; var cc:char; var X,Xbe,Y:longint; Yb,Ye,Xb,Xe:real; var Z,Z1,C: record Re,Im:real; end; Krok:integer; PROCEDURE Mandel; begin C.Im:=Yb; while C.Im<=Ye do begin X:=Xbe; 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){ or (Abs(Z.Im)>2)}; mem[$0a000:word(X+Y*320)]:=Krok mod 100; C.Re:=C.Re+(Xe-Xb)/320{round(200*1.203)}; X:=X+1; end; C.Im:=C.Im+(Ye-Yb)/200; Y:=Y+1; end; end; begin asm mov ax,0013h int 10h end; Y:=0; Xbe:=0; Yb:=-1.5; Ye:=1.5; Xb:=-2.5; Xe:=1.5; Mandel; cc:=readkey; { Y:=0; Xbe:=40; Yb:=-0.5; Ye:=-0.4; Xb:=-0.35; Xe:=0.15; Mandel; cc:=readkey; } { Y:=0; Xbe:=0; Yb:=-0.457; Ye:=-0.449; Xb:=-0.156; Xe:=-0.147; Mandel; cc:=readkey; } end.