This article has been dead for over three months
You
program MoveSec;
Uses Dos, Crt;
const
Width = 80;
waittime = 30;
gametime = 10.0; { time to play in seconds }
var
c: char;
i, x: byte;
start, endtime: real;
function timer:real;
var hour,minute,second,sec100:word;
begin
gettime(hour,minute,second,sec100);
timer:=(hour*3600.0+minute*60.0+second+sec100/100.0)
end;
begin
start := timer;
endtime := start + gametime;
x := trunc(Width / 2);
repeat
delay(waittime);
while keypressed do
begin
c := readkey;
if c = #0 then
begin
c := readkey;
write(#13);
case c of
#75: if x > 2 then Dec(x);
#77: if (x <= Width - 10) then Inc(x);
end;
end;
for i := 1 to x do write(' ');
write(trunc(endtime-timer),' ');
end;
until (c = 'q') or (timer >= endtime);
if c <> 'q' then writeln(#10,'Game time finished');
end.