1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| procedure calculevolution(n:integer);
var i,j,k,l,C:integer; t1,t2:tableaunombres; nbmortetouffement, nbmortisolement, nbnaissance, nbsurvie:integer;
begin
for i:=0 to (lmax+1) do
for j:=0 to (hmax+1) do
t2[i,j]:=0;
begin
for i:=1 to lmax do
for j:=1 to hmax do
begin
C:=0;
for k:=i-1 to i+1 do
for l:=j-1 to j+1 do
if t1[k,l]=1 then C:=C+1;
C:=C-t1[i,j];
if (t1[i,j]=1) and (C>=nbmortetouffement) then t2[i,j]=0
else if (t1[i,j]=1) and (C<=nbmortisolement) then t2[i,j]=0
else if (t1[i,j]=0) and (C=nbnaissance) then t2[i,j]=1
else t2[i,j]=t1[i,j]
end;
end;
end; |
Partager