Движущиеся фигуры. Например:
4. Приложение
Текст программы «Жизнь» (файл life.pas)
uses
crt,graph,mono3d;
var
A,B:array[0..51,0..31]of boolean;
i,j,VP,step,live,dead,born:integer;
s,stri:string;
label l;
Function Nears(x,y:integer):integer;
{}
{} var
{} i,j,s:integer;
{}
Begin
{}
{} s:=0;
{} for i:=x-1 to x+1 do
{} for j:=y-1 to y+1 do
{} if a[i,j] then s:=s+1;
{} if a[x,y] then s:=s-1;
{} Nears:=s;
{}
End;
Function Change:Boolean;
Begin
{}
{} born:=0;
{} dead:=0;
{} Change:=False;
{}
{} for i:=1 to 50 do
{} for j:=1 to 30 do
{} begin
{} {}
{} {} if A[i,j] then
{} {} begin
{} {} {} if ((Nears(i,j)<2) or (Nears(i,j)>3)) then
{} {} {} begin
{} {} {} {} B[i,j]:=False;
{} {} {} {} dead:=dead+1;
{} {} {} {} Change:=True;
{} {} {} end;
{} {} end
{} {} else
{} {} begin
{} {} {} if Nears(i,j)=3 then
{} {} {} begin
{} {} {} {} B[i,j]:=True;
{} {} {} {} born:=born+1;
{} {} {} {} Change:=True;
{} {} {} end;
{} {} end;
{} {}
{} end;
{}
End;
Procedure Setup;
{}
{} var
{} i,j:integer;
{}
Begin
{}