var
x:array[1..20,1..20]of integer;
i,c,u,j:integer;
q,w:integer;
s:array[1..20,1..20]of boolean;
begin
for i:=1 to 20 do
for j:=1 to 20 do begin
randomize;
x[i,j]:=random(3);
if x[i,j]>0 then x[i,j]:=1
else inc(u);
end;
for i:=1 to 20 do begin
for j:=1 to 20 do if s[i,j]=false then write('█')
else begin
if x[i,j]<1 then begin write('×');u:=0;end;
if x[i,j]=1 then begin
if x[i+1,j]=0 then c:=c+1;
if x[i+1,j+1]=0 then c:=c+1;
if x[i+1,j-1]=0 then c:=c+1;
if x[i,j+1]=0 then c:=c+1;
if x[i,j-1]=0 then c:=c+1;
if x[i-1,j+1]=0 then c:=c+1;
if x[i-1,j]=0 then c:=c+1;
if x[i-1,j-1]=0 then c:=c+1;
write(c);
end
end
writeln;
end;
while u>0 do begin
read(q,w);
s[q,w]:=true;
for i:=1 to 20 do begin
for j:=1 to 20 do if s[i,j]=false then write('█')
else begin
if x[i,j]<1 then begin write('×');u:=0;end;
if x[i,j]=1 then begin
if x[i+1,j]=0 then c:=c+1;
if x[i+1,j+1]=0 then c:=c+1;
if x[i+1,j-1]=0 then c:=c+1;
if x[i,j+1]=0 then c:=c+1;
if x[i,j-1]=0 then c:=c+1;
if x[i-1,j+1]=0 then c:=c+1;
if x[i-1,j]=0 then c:=c+1;
if x[i-1,j-1]=0 then c:=c+1;
write(c);
end
end
writeln;
end;
end;
readln;
end.
x:array[1..20,1..20]of integer;
i,c,u,j:integer;
q,w:integer;
s:array[1..20,1..20]of boolean;
begin
for i:=1 to 20 do
for j:=1 to 20 do begin
randomize;
x[i,j]:=random(3);
if x[i,j]>0 then x[i,j]:=1
else inc(u);
end;
for i:=1 to 20 do begin
for j:=1 to 20 do if s[i,j]=false then write('█')
else begin
if x[i,j]<1 then begin write('×');u:=0;end;
if x[i,j]=1 then begin
if x[i+1,j]=0 then c:=c+1;
if x[i+1,j+1]=0 then c:=c+1;
if x[i+1,j-1]=0 then c:=c+1;
if x[i,j+1]=0 then c:=c+1;
if x[i,j-1]=0 then c:=c+1;
if x[i-1,j+1]=0 then c:=c+1;
if x[i-1,j]=0 then c:=c+1;
if x[i-1,j-1]=0 then c:=c+1;
write(c);
end
end
writeln;
end;
while u>0 do begin
read(q,w);
s[q,w]:=true;
for i:=1 to 20 do begin
for j:=1 to 20 do if s[i,j]=false then write('█')
else begin
if x[i,j]<1 then begin write('×');u:=0;end;
if x[i,j]=1 then begin
if x[i+1,j]=0 then c:=c+1;
if x[i+1,j+1]=0 then c:=c+1;
if x[i+1,j-1]=0 then c:=c+1;
if x[i,j+1]=0 then c:=c+1;
if x[i,j-1]=0 then c:=c+1;
if x[i-1,j+1]=0 then c:=c+1;
if x[i-1,j]=0 then c:=c+1;
if x[i-1,j-1]=0 then c:=c+1;
write(c);
end
end
writeln;
end;
end;
readln;
end.