Uses
Crt,Graph; {Stroka, soobschayuschaya, chto nuzhno vklyuchit' moduli Crt i Graph v programmu}
Const
a1:string='L A B O R A T O R N A Y A R A B O T A';
a2:string='O P R E D E L E N I E S K O R O S T I T E L A';
a3:string='Dlya prodolzheniya nazhmite lyubuyu klavishu';
a4:string='Vvedite vremya (.1
0.5) or (dt <= 0)) then
dt:=0;
end;
Procedure movekursor;
Var
st:string[3];
begin
ch:=readkey; {Schityvanie nazhatoi klavishi}
SetColor(0); {Zakrashivaem sled ot dvizheniya kursora}
Line(cx-5,cy,cx+5,cy);
Line(cx,cy-5,cx,cy+5);
Circle(cx,cy,5);
if (ord(ch)=72) then cy:=cy-1;{Schityvaem ScanCode s klaviatury i proveryaem sootvetstvuet li on nazhatiyu klavishi}
{vverh}
if (ord(ch)=80) then cy:=cy+1;{Schityvaem ScanCode s klaviatury i proveryaem sootvetstvuet li on nazhatiyu klavishi}
{vniz}
if (ord(ch)=75) then cx:=cx-1;{Schityvaem ScanCode s klaviatury i proveryaem sootvetstvuet li on nazhatiyu klavishi}
{vlevo}
if (ord(ch)=77) then cx:=cx+1;{Schityvaem ScanCode s klaviatury i proveryaem sootvetstvuet li on nazhatiyu klavishi}
{vpravo}
if (cx<6) then cx:=6; {Ogranichenie polozheniya kursora pri dvizhenii vlevo}
if (cx>622) then cx:=622; {Ogranichenie polozheniya kursora pri dvizhenii vpravo}
if (cy<6) then cy:=6; {Ogranichenie polozheniya kursora pri dvizhenii vverh}
if (cy>464) then cy:=464; {Ogranichenie polozheniya kursora pri dvizhenii vniz}
SetColor(15);
Line(cx-5,cy,cx+5,cy);
Line(cx,cy-5,cx,cy+5);
Circle(cx,cy,5);
cxx:=cx;
cyy:=cy;
begin
menu; {Perehod k protsedure}
end;
SetColor(15);
Circle(cx,cy,5);
Line(cx-5,cy,cx+5,cy);
Line(cx,cy-5,cx,cy+5);
if ord(ch)=32 then {Schityvaem ScanCode s klaviatury, esli nazhata dannaya klavisha, to...}
begin
SetFillStyle(1,0);
Bar(0,0,640,480); {Zakrashivaem ekran}
kursor; {Perehod k protsedure}
end;
end;
begin
gd:=detect; {Avtomaticheskoe raspoznavanie videoadaptera}
af:=6;
bf:=6;
InitGraph(gd,gm,'d:\tp\bgi'); {Pereklyuchenie v graficheskii rezhim}
start; {Perehod k protsedure}
kursor; {Perehod k protsedure}
repeat
movekursor; {Perehod k protsedure}
until
ord(ch)=27; {Schityvaem ScanCode s klaviatury, esli nazhata dannaya klavisha, to...}
end. {Okonchanie razdela operatorov}