P.42.6 Ответы
Program AA;
uses crt, dos, graph;
var
r : registers;
xx, yy : integer;
Gd, Gm : integer;
MLeft, MRight, MUp, MDown : array[0..6] of integer;
procedure X1;
begin
SetColor(Black);
Line(xx-9,yy,xx-3,yy);
Line(xx+3,yy,xx+9,yy);
Line(xx,yy-9,xx,yy-3);
Line(xx,yy+3,xx,yy+9);
end;
procedure X3;
var
ii : integer;
begin
for ii:=xx-9 to xx-3 do MLeft[ii-xx+9]:=GetPixel(ii,yy);
for ii:=xx+3 to xx+9 do MRight[ii-xx-3]:=GetPixel(ii,yy);
for ii:=yy-9 to yy-3 do MUp[ii-yy+9]:=GetPixel(xx,ii);
for ii:=yy+3 to yy+9 do MDown[ii-yy-3]:=GetPixel(xx,ii);
end;
procedure X4;
var
ii : integer;
begin
for ii:=xx-9 to xx-3 do PutPixel(ii,yy,MLeft[ii-xx+9]);
for ii:=xx+3 to xx+9 do PutPixel(ii,yy,MRight[ii-xx-3]);
for ii:=yy-9 to yy-3 do PutPixel(xx,ii,MUp[ii-yy+9]);
for ii:=yy+3 to yy+9 do PutPixel(xx,ii,MDown[ii-yy-3]);
end;
begin
Gd:=Detect; InitGraph(Gd,Gm,’’);
SetFillStyle(SolidFill,White);
Bar(0,0,GetMAxX,GetMaxY);
xx:=GetMaxX div 2; yy:=GetMaxY div 2;
X3; X1;
repeat
r.ax:=$0000; Intr($16,r);
if (lo(r.ax)=0) and (hi(r.ax)=72) and (yy>10) then begin
X4; yy:=yy-1; X3; X1;
end;
if (lo(r.ax)=0) and (hi(r.ax)=80) and (yy
X4; yy:=yy+1; X3; X1;
end;
if (lo(r.ax)=0) and (hi(r.ax)=75) and (xx>10) then begin
X4; xx:=xx-1; X3; X1;
end;
if (lo(r.ax)=0) and (hi(r.ax)=77) and (xx
X4; xx:=xx+1; X3; X1;
end;
if (lo(r.ax)=32) and (hi(r.ax)=57) then begin
if GetPixel(xx,yy)<>Black then
PutPixel(xx,yy,Black)
else
PutPixel(xx,yy,White);
end;
until (lo(r.ax)=27) and (hi(r.ax)=1);
closegraph;
end.