60
Y:=Man[i].Y;
Man[i].X:=X-1;
Man[i].Y:=Y;
if (X>1) and (Pole[Y,X-1].St<>’1') then
Begin
if (Pole[Y,X-1].Num>=Pole[Y,X].Num+1) then
Begin
Pole[Y,X-1].Num:=Pole[Y,X].Num+1;
Pole[Y,X-1].St:=’M’;
Test(i+1);
Pole[Y,X-1].St:=’0';
Pole[Y,X-1].Num:=255;
End;
End;
Man[i].X:=X+1;
Man[i].Y:=Y;
if (X<M) and (Pole[Y,X+1].St<>’1') then
Begin
if (Pole[Y,X+1].Num>=Pole[Y,X].Num+1) then
Begin
Pole[Y,X+1].Num:=Pole[Y,X].Num+1;
Pole[Y,X+1].St:=’M’;
Test(i+1);
Pole[Y,X+1].St:=’0';
Pole[Y,X+1].Num:=255;
End;
End;
Man[i].X:=X;
Man[i].Y:=Y-1;
if (Y>1) and (Pole[Y-1,X].St<>’1') then
Begin
if (Pole[Y-1,X].Num>=Pole[Y,X].Num+1) then
Begin
Pole[Y-1,X].Num:=Pole[Y,X].Num+1;
Pole[Y-1,X].St:=’M’;
Test(i+1);
Pole[Y-1,X].St:=’0';
Pole[Y-1,X].Num:=255;
End;
End;
Man[i].X:=X;
Man[i].Y:=Y+1;
if (Y<N) and (Pole[Y+1,X].St<>’1') then
Begin
if (Pole[Y+1,X].Num>=Pole[Y,X].Num+1) then
Begin
Pole[Y+1,X].Num:=Pole[Y,X].Num+1;
Pole[Y+1,X].St:=’M’;
Test(i+1);