program relativitatea_miscarii_mecanice;
uses crt,graph;
label repetare;
procedure ipg;
var gd,gm:integer;
begin
   gd:=9;gm:=2;
   initgraph(gd,gm,'c:\limbaje\tp\bgi');
end;
procedure teorie;
begin
  setbkcolor(9);
   cleardevice;
  setcolor(15);
  settextstyle(1,0,2);
   outtextxy(120,43,'Ap†sati "1" pentru a vedea simultan');
   outtextxy(120,63,'     "2" pentru a vedea separat');
   outtextxy(120,83,'         sau "i" pentru a iesi');
end;
procedure pause;
begin
readkey;
readkey;
end;
procedure simultan;
var i:integer;
begin
  setbkcolor(2);
   cleardevice;
  setcolor(14);
  setlinestyle(0,0,3);
   line(320,0,320,480);
  setlinestyle(0,0,1);
  setcolor(12);
  setfillstyle(1,12);
   bar(120,200,200,280);
  setcolor(13);
  setfillstyle(1,13);
   bar(122,202,198,278);
  setcolor(12);
   line(120,200,200,280);
   line(200,200,120,280);
   outtextxy(20,50,'c†derea liber† a unui corp');
   outtextxy(20,70,'    v†zut† din avion');
   outtextxy(340,50,'c†derea liber† a unui corp');
   outtextxy(340,70,'   v†zut† de pe p†mƒnt');
  setlinestyle(0,0,3);
  setfillstyle(3,brown);
  setcolor(brown);
   line(321,272,640,272);
   bar(321,272,640,472);
  setlinestyle(0,0,1);
   for i:=0 to 39 do
     begin
       { partea din stƒnga }
       setcolor(2);
        rectangle(120+i,200+i,200-i,280-i);
       setcolor(12);
       setfillstyle(1,12);
        rectangle(122+i,202+i,198-i,278-i);
       { partea din dreapta }
       setcolor(12);
       setfillstyle(1,12);
        bar(580-5*i,100+round(7000/(3*(53-i))),580-5*i+3,100+round(7000/(3*(53-i)))+3);
        delay(200);
        if keypressed then pause;
       setcolor(2);
       setfillstyle(1,2);
        bar(580-5*i,100+round(7000/(3*(53-i))),580-5*i+3,100+round(7000/(3*(53-i)))+3);
     end;
  setcolor(12);
  setfillstyle(1,12);
   bar(580-5*i,100+round(7000/(3*(53-i))),580-5*i+3,100+round(7000/(3*(53-i)))+3);
   readkey;
end;
procedure separat;
var i:integer;
begin
  setbkcolor(2);
   cleardevice;
  setcolor(12);
  setfillstyle(1,12);
   bar(280,200,360,280);
  setcolor(13);
  setfillstyle(1,13);
   bar(282,202,358,278);
  setcolor(12);
   line(280,200,360,280);
   line(360,200,280,280);
   outtextxy(180,50,'c†derea liber† a unui corp');
   outtextxy(180,70,'    v†zut† din avion');
   for i:=0 to 39 do
     begin
       setcolor(2);
        rectangle(280+i,200+i,360-i,280-i);
       setcolor(12);
       setfillstyle(1,12);
        rectangle(282+i,202+i,358-i,278-i);
        delay(200);
        if keypressed then pause;
     end;
   outtextxy(150,400,'Ap†sati o tast† pentru continuare');
   readkey;
   cleardevice;
   outtextxy(180,50,'c†derea liber† a unui corp');
   outtextxy(180,70,'   v†zut† de pe p†mƒnt');
  setlinestyle(0,0,3);
  setfillstyle(3,brown);
  setcolor(brown);
   line(0,364,640,364);
   bar(0,364,640,480);
  setlinestyle(0,0,1);
   for i:=0 to 44 do
     begin
       setcolor(12);
       setfillstyle(1,12);
        bar(420-5*i,100+round(7000/(3*(53-i))),420-5*i+3,100+round(7000/(3*(53-i)))+3);
        delay(200);
        if keypressed then pause;
       setcolor(2);
       setfillstyle(1,2);
        bar(420-5*i,100+round(7000/(3*(53-i))),420-5*i+3,100+round(7000/(3*(53-i)))+3);
     end;
  setcolor(12);
  setfillstyle(1,12);
   bar(420-5*i,100+round(7000/(3*(53-i))),420-5*i+3,100+round(7000/(3*(53-i)))+3);
   readkey;
end;
procedure sfarsit;
begin
closegraph;
end;
begin
ipg;
repetare:teorie;
case readkey of
 '1':simultan;
 '2':separat;
 'i':sfarsit
 else begin
        sound(753);delay(1000);nosound;
        goto repetare;
      end;
 end;
goto repetare;
end.