program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils,crt32,windows;
type
coord = record
x: integer;
y: integer;
end;
var
m: array[1..22] of array[1..80] of char;
procedure Show;
var
i,n: integer;
begin
ClrScr;
for i:=1 to 22 do
for n:=1 to 80 do write(m[i,n]);
end;
var
i,n,t1,tng1,tt1,ttt: integer;
sbi: TConsoleScreenBufferInfo;
sw:string;
key: char;
p1:COORD;
p2:COORD;
go1: boolean;
begin
go1:=false;
{ TODO -oUser -cConsole Main : Insert code here }
for i:=1 to 80 do m[1,i]:='0';
for i:=2 to 21 do
begin
m[i,1]:='0';
m[i,80]:='0';
end;
p2.x:=3;
p2.y:=20;
p1.x:=77;
p1.y:=20;
m[p2.y,p2.x]:='2';
m[p1.y,p1.x]:='1';
for i:=1 to 80 do m[22,i]:='0';
Show;
t1:=9;
tng1:=0;
ttt:=0;
While key<>#121 do
begin
if go1 then
begin
inc(tng1);
if (tt1=t1) then
begin
if(tng1>10) then
begin
go1:=false;
t1:=9;
tng1:=0;
end;
end
else
tt1:=t1;
end;
key:=readkey;
//Writeln(key,' ',ord(key));
case ord(key) of
37:
begin
go1:=true;
inc(t1);
if t1=10 then t1:=0;
tt1:=t1;
if t1<>0 then continue;
WriteChrXY(p1.x,p1.y,' ');
//m[p.x,p1.y]:=' ';
p1.x:=p1.x-1;
//m[p.y,p.x]:='1';
WriteChrXY(p1.x,p1.y,'1');
GotoXY(1,23);
// ClrEol;
end;
38:
begin
WriteChrXY(p1.x,p1.y,' ');
//m[p.x,p.y]:=' ';
p1.y:=p1.y-1;
//m[p.y,p.x]:='1';
WriteChrXY(p1.x,p1.y,'1');
GotoXY(1,23);
// ClrEol;
end;
39:
begin
WriteChrXY(p1.x,p1.y,' ');
//m[p.x,p.y]:=' ';
p1.x:=p1.x+1;
//m[p.y,p.x]:='1';
WriteChrXY(p1.x,p1.y,'1');
GotoXY(1,23);
// ClrEol;
end;
40:
begin
WriteChrXY(p1.x,p1.y,' ');
//m[p.x,p.y]:=' ';
p1.y:=p1.y+1;
//m[p.y,p.x]:='1';
WriteChrXY(p1.x,p1.y,'1');
GotoXY(1,23);
// ClrEol;
end;
65:
begin
WriteChrXY(p2.x,p2.y,' ');
//m[p.x,p1.y]:=' ';
p2.x:=p2.x-1;
//m[p.y,p.x]:='1';
WriteChrXY(p2.x,p2.y,'2');
GotoXY(1,23);
// ClrEol;
end;
87:
begin
WriteChrXY(p2.x,p2.y,' ');
//m[p.x,p.y]:=' ';
p2.y:=p2.y-1;
//m[p.y,p.x]:='1';
WriteChrXY(p2.x,p2.y,'2');
GotoXY(1,23);
// ClrEol;
end;
68:
begin
WriteChrXY(p2.x,p2.y,' ');
//m[p.x,p.y]:=' ';
p2.x:=p2.x+1;
//m[p.y,p.x]:='1';
WriteChrXY(p2.x,p2.y,'2');
GotoXY(1,23);
// ClrEol;
end;
83:
begin
WriteChrXY(p2.x,p2.y,' ');
//m[p.x,p.y]:=' ';
p2.y:=p2.y+1;
//m[p.y,p.x]:='1';
WriteChrXY(p2.x,p2.y,'2');
GotoXY(1,23);
// ClrEol;
end;
end;
end;
end.