uses crt,graph;
const r=20;h=5;
var gd,gm,i,n,t,x,y,p:integer;
begin
gd:=Detect;
initgraph(gd,gm,' ');
setcolor(green);
setlinestyle(0,1,3);
line(0,479,639,479);
setlinestyle(0,0,1);
x:=r;y:=r;
t:=479-2*r;
n:=t div h;
p:=h;
while n<>0 do
begin
for i:=1 to n do
begin
setcolor(yellow);
circle(x,y,r);
setfillstyle(1,14);
floodfill(x,y,14);
delay(20);
setcolor(0);
circle(x,y,r);
setfillstyle(1,0);
floodfill(x,y,0);
y:=y+p;
x:=x+1;
end;
if p>0 then
begin
t:=round(3*t/4);
n:=t div h
end;
p:=-p
end;
setcolor(12);
circle(x,y,r);
setfillstyle(1,12);
floodfill(x,y,12);
readkey;
end.