47
Readln(F,Bufer);
Val(Copy(Bufer,1,Pos(“,”,Bufer)-1),N,Code);
Val(Copy(Bufer,Pos(“,”,Bufer)+1,Length(Bufer)),M,Code);
for j:=1 to N do
Begin
Readln(F,Bufer);
for i:=1 to M do
Begin
Pole[i,j].Con:=Bufer[i];
End;
End;
Readln(F,Bufer);
Val(Copy(Bufer,1,Pos(“,”,Bufer)-1),ManY,Code);
Delete(Bufer,1,Pos(“,”,Bufer));
Val(Copy(Bufer,1,Pos(“,”,Bufer)-1),ManX,Code);
Delete(Bufer,1,Pos(“,”,Bufer));
Val(Copy(Bufer,1,Pos(“,”,Bufer)-1),K,Code);
Delete(Bufer,1,Pos(“,”,Bufer));
Val(Copy(Bufer,1,length(Bufer)),C,Code);
Delete(Bufer,1,Pos(“,”,Bufer));
End;
Procedure Test(Var Pole : TypePole; x,y : integer);
Label
M1,M2,M3,M4;
Var
Txy:TypeTxy;
It:Integer;
Begin
Info.x:=X;
Info.Y:=y;
TestLadya(Info,Txy,1,1,N,M);
for it:=1 to 4 do
if (Txy[it].X<>0) then
Begin
if (Pole[Txy[it].X,Txy[it].Y].Con=’-’) and (Pole[x,y].Step mod 2 = 0) then goto M1;
if (Pole[TXy[it].X,TXy[it].Y].Con=’+’) and (Pole[x,y].Step mod 2 = 1) then goto M1;
if (Pole[x,y].Step+1<Pole[TXy[it].X,Txy[it].y].Step)
then
Begin
if (Pole[TXy[it].x,Txy[it].y].Con=’1') and (Pole[x,y].Kirka<=0) then goto M1;
if Pole[Txy[it].X,Txy[it].y].Con=’1'
then
Begin
Pole[TXy[it].X,TXy[it].Y].Kirka:=Pole[x,y].Kirka-1;
Pole[Txy[it].X,Txy[it].y].Step:=Pole[x,y].Step+1+K;
PushRight(Turn,@Txy[it],OK);
End
else
Begin