true then k:=k+1;
if n<g then if p[n+1,m]=true then k:=k+1;
if n<g then if m<g then if p[n+1,m+1]=true then k:=k+1;
if m<g then if p[n,m+1]=true then k:=k+1;
if m<g then if n>0 then if p[n-1,m+1]=true then k:=k+1;
if p[n,m]=false then if k=3 then if l=0 then p[n,m]:=true;
if p[n,m]=true then if k<2 then if l=0 then p[n,m]:=false;
if p[n,m]=true then if k>3 then if l=0 then p[n,m]:=false;
end;
begin
window.Height:=200;
window.Width:=200;
var ps:=200;
setlength(p,ps,ps);
for var i:=0 to ps-1 do begin
for var j:=0 to ps-1 do begin
p[i,j]:=false;
if random(1000)<80 then p[i,j]:=true;
end;
end;
var hh:=0;
while 0=0 do begin
hh:=hh+1;
for var i:=0 to ps-1 do begin
for var j:=0 to ps-1 do begin
if p[i,j]=false then begin
FindNeightboors(i,j,ps);
end;
if p[i,j]=true then begin
FindNeightboors(i,j,ps);
end;
end;
end;
//sleep(5);
LockDrawing;Window.Clear;
SetWindowTitle(inttostr(hh));
for var i:=0 to ps-1 do begin
for var j:=0 to ps-1 do begin
if p[i,j]=true then begin
putpixel(i,j,clred);
end;
end;
end;
Redraw;
end;
end.