Lỗi 201 trong pascal, mong mn người giúp mình tìm chỗ sai với!
program ho;
uses crt;
var b:array[1..2,1..4] of integer;
c1,h1,c,h,i,i1,dem,i2,u:integer;
a:array[1..100,1..100] of integer;
d,d1:array[1..2,1..100] of integer;
j:array[1..2,1..100,1..100] of integer;
f,f1:text;
t:boolean;
begin
clrscr;
assign(f,'D:\1.txt');
assign(f1,'D:\1.out');
reset(f); h1:=0; c1:=0;
while not eof(f) do
begin inc(h1) ; while not eoln(f) do begin inc(c1); read(f,a[c1,h1]); end;
readln(f);
end;
d[1,1]:=a[c1-1,h1]; d[2,1]:=a[c1,h1]; i:=1; i1:=0; i2:=1;
j[1,1,1]:=d[1,1]; j[2,1,1]:=d[2,1];
while i<>0 do {(mình thấy cái vòng lặp lớn cho lặp 2 lần trở lên là lỗi)}
begin
inc(i2);
for dem:=1 to i do if ((d[1,dem]<c1) and (d[1,dem]>0)) then
begin
b[1,1]:=d[1,dem]-1;
b[1,2]:=d[1,dem];
b[1,3]:=d[1,dem]+1;
b[1,4]:=d[1,dem];
if ((d[2,dem]<h1) and (d[2,dem]>0)) then
begin
b[2,1]:=d[2,dem];
b[2,2]:=d[2,dem]-1;
b[2,3]:=d[2,dem];
b[2,4]:=d[2,dem]+1;
for c:=1 to 4 do
begin
t:=true;
if a[d[1,dem],d[2,dem]] = a[b[1,c],b[2,c]] then
begin
for h:=1 to i do
if ( (b[1,c] = d[1,h]) and (b[2,c] = d[2,h]) ) then t:=false;
for h:=1 to i1 do
if ( (b[1,c] = d1[1,h]) and (b[2,c] = d1[2,h]) ) then t:=false;
end;
if t then
begin
inc(i1); d1[1,i1]:=b[1,c]; d1[2,i1]:=b[2,c]; j[1,i2,i1]:=b[1,c]; j[2,i2,i1]:=b[2,c];
for h:=1 to i2-1 do begin j[1,h,i1]:=j[1,h,dem]; j[2,h,i1]:=j[2,h,dem] end;
end;
end;
end;
end;
for dem:=1 to i1 do begin d[1,dem]:=d1[1,dem]; d[2,dem]:=d1[2,dem]; end;
i:=i1; i1:=0;
end;
rewrite(f1);
for h:=1 to i do if j[1,i2,h]<> 0 then begin for c:=1 to i2 do writeln(f1,j[1,c,h],' ',j[2,c,h]); break end;
close(f); close(f1);
readln
end.