program FernIFS;
uses GRAPH, CRT;
const NUMIT = 128000;
var a, b, c, d, e, f : array [1..4] of real;
(*********************************)
procedure Load_Arrays;
begin
a[1]:=0; b[1]:=0;
c[1]:=0; d[1]:= 0.16;
e[1]:=0; f[1]:=0; {p[1]:=0.01;}
a[2]:=0.85; b[2]:=0.04;
c[2]:=-0.04; d[2]:=0.85;
e[2]:=0; f[2]:=1.6; {p[2]:=0.85;}
a[3]:=0.20; b[3]:=-0.26;
c[3]:=0.23; d[3]:=0.22;
e[3]:=0; f[3]:=1.6; {p[3]:=0.07; }
a[4]:=-0.15; b[4]:=0.28;
c[4]:=0.26; d[4]:=0.24;
e[4]:=0; f[4]:=0.44; {p[4]:=0.07; }
end;
(*********************************)
procedure prepit;
var driver, mode : integer;
begin
driver:= DETECT;
initgraph(driver, mode, '');
end;
(*********************************)
procedure chaos;
var currit, rndnum : longint;
x, y, plotx, ploty : real;
pick : integer;
begin
x:=0; y:=0;
randomize;
for currit:= 1 to NUMIT do
begin
pick := random(101) - 84;
if (pick <= 0) then rndnum:=2
else if (pick<=7) then rndnum:=3
else if (pick<=15) then rndnum:=4
else rndnum:=1;
plotx:= ((a[rndnum]*x + b[rndnum]*y + e[rndnum]));
ploty:= ((c[rndnum]*x + d[rndnum]*y + f[rndnum]));
x:= plotx;
y:= ploty;
putpixel(round(plotx*100)+320, round(ploty*100), BLUE);
end;
end;
(*********************************)
begin
prepit;
Load_Arrays;
Chaos;
sound(100); sound(1000);
delay(45);
nosound;
readln;
CloseGraph;
end.
|