Help Meeeeeee! What the hell's wrong?????????
Can you correct my mistake please!!!!!!
var m : Array[-10..20,-10..20] of 0..1;
i,j,k,n,a,b : INTEGER;
Flag : Boolean;
e : array[1..100] of record x,y : integer; end;
procedure work;
var z,l,index,beg,en : integer;
begin
index := 1; beg := 1; en := 1;
e[1].x:=a; e[1].y:=b;
m[a,b]:=0;
for j:=1 to n do
begin
for i:=beg to en do
begin
if m[e[i].x,e[i].y+1] = 1 then
begin
m[e[i].x,e[i].y+1] := 0;
inc(index);
e[index]:=e[i];
inc(e[index].y);
write('R');
end;
if m[e[i].x+1,e[i].y] = 1 then
begin
m[e[i].x+1,e[i].y] := 0;
inc(index);
e[index]:=e[i];
inc(e[index].x);
write('B');
end;
if m[e[i].x,e[i].y-1] = 1 then
begin
m[e[i].x,e[i].y-1] := 0;
inc(index);
e[index]:=e[i];
dec(e[index].y);
write('L');
end;
if m[e[i].x-1,e[i].y] = 1 then
begin
m[e[i].x-1,e[i].y] := 0;
inc(index);
e[index]:=e[i];
dec(e[index].x);
write('T');
end;
if i <> index then writeln(',') else writeln('.');
end;
beg := en + 1; en := index;
end;
end;
begin
readln(n); for i:= 1 to n do begin readln(j,k); m[10-k+1,j]:=1; end;
{ Tursene na nai dolen lqv element }
Flag := False;
for i := 1 to 10 do
if Flag then break else
for j:= 10 downto 1 do
if m[j,i] = 1 then begin Flag := True; a:=j; b:=i; Break end;
{ ... }
work;
end.