program trimestrul_3;
uses crt,graph;
type linie=array[0..100]of integer;
     hjk=array[1..12] of integer;
const p1:linie=(450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,
465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,
484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,
503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,
522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,
541,542,543,544,545,546,547,548,549,550);
      ste:hjk=(3,4,5,6,4,12,11,7,13,2,9,10);
      oriz=#205;vert=#186;coltstsus=#201;coltdrsus=#187;
      coltstjos=#200;coltdrjos=#188;
var dim,dim1,dim2:word;
    p,p11,p12:pointer;
    pas,at1:real;
    plai,plaj,linia,te,j,q,x,y4,dx,dy,x1,y1,x0,y0,x3,y3,dx3,dy3,rx,ry,lung,inalt,lung1,inalt1,i1,a,b,lg:integer;
    text,text1,text2:string[80];
    c1:string;
procedure cer;
var j,x,y4:integer;
begin
  randomize;te:=te+1 ;
  for j:=1 to 5000 do
     begin
       x:=random(639);y4:=random(479);
       putpixel(x,y4,ste[te]);
     end;
end;
procedure spir(x0,y0,pas:integer);
begin
  x1:=600;y1:=y0;moveto(x0,y0);
  for i1:=1 to 15 do
    begin
      linerel(0,-y1);linerel(x1,0);delay(30);
      x1:=x1-pas;y1:=y1-pas;
      linerel(0,y1);linerel(-x1,0);delay(30);
      x1:=x1-pas;y1:=y1-pas;
    end;
end;
procedure sat(caracter:string);
begin
  setcolor(yellow);
  circle(320,240,80);setfillstyle(1,black);
  floodfill(320,240,yellow);
  ellipse(320,235,128,52,120,40);
  pas:=pi*120/180;setcolor(black);
   pas:=pi*130/180;settextstyle(1,0,2);
  for j:=1 to 27 do
  begin
    pas:=pas+pi/18;
    x:=round(320+120*cos(pas));y4:=round(235-40*sin(pas));
    setfillstyle(1,blue);
   fillellipse(x,y4,18,18);outtextxy(x-5,y4-9,caracter);
   delay(100);setfillstyle(1,black);fillellipse(x,y4,18,18);
   setcolor(black);ellipse(x,y4,0,360,18,18);
   setcolor(yellow);ellipse(320,235,128,52,120,40);
    circle(320,240,80);
  end;
  delay(1500);
end;
procedure patrat(x0,y0,l1,l2,pas:integer);
  begin
    rectangle(x0,y0,x0+l1,y0+l2);delay(50);
    if l2>2*pas then
      patrat(x0+pas,y0+pas,l1-2*pas,l2-2*pas,pas);delay(50);
  end;
procedure lit(x1:integer;c1:string);
  begin
    for j:=1 to 90 do
      begin
        outtextxy(x1,3*j,c1);
        bar(x1,3*j,x1+textwidth(c1),3*j+textheight(c1));
      end;
  end;
procedure timi;
begin
 setcolor(yellow);cer;
 a:=500;b:=170;i1:=0;
 x:=0;y4:=0;dx:=0;dy:=0;at1:=pi/2;y0:=b;
  for i1:=1 to 54 do
    begin
      at1:=at1-pi/72;
      x:=round(a*cos(at1));y4:=y0-round(b*sin(at1));
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('proiect');dy:=40+textheight('proiect');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'proiect');
      delay(100);
    end;
  a:=a div 3;x0:=a+70;b:=b div 3;y0:=y0+b+23;
  at1:=7*pi/4;
  for i1:= 55 to 91 do
    begin
      at1:=at1-pi/36;
      x:=x0+round(a*cos(at1));y4:=y0-round(b*sin(at1));
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('proiect');dy:=40+textheight('proiect');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'proiect');
      delay(100);
    end;
  delay(1000);
  setviewport(0,0,639,479,clipon);
  cleardevice;
  for j:=1 to 3 do
    begin
      setcolor(yellow);spir(0,450,15);
      setcolor(black);spir(0,450,15);
  end;
    delay(1000);setcolor(yellow);
     setviewport(0,0,639,479,clipon);cleardevice;
     cer;
  x:=10;y4:=443;x3:=598;y3:=443; setcolor(yellow);
     for i1:=1 to 49 do
     begin
       x:=x+1;y4:=y4-9;x3:=x3-4;y3:=y3-9;
       settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1,125);
      dx:=20+textwidth('Motorul');dy:=40+textheight('Motorul');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Motorul');
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1,125);
      dx3:=20+textwidth('Diesel');dy3:=40+textheight('Diesel');
      setviewport(x3,y3,x3+dx3,y3+dy3,clipon);
      setfillstyle(1,red);bar(0,0,dx3,dy3);
      rectangle(0,0,dx3,dy3);
      outtextxy(10,10,'Diesel');
      delay(100);
  end;
    for i1:=51 to 67 do
      begin
        x:=x+3;y4:=y4+10;x3:=x3-5;y3:=y3+10;
       settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1,125);
      dx:=20+textwidth('Motorul');dy:=40+textheight('Motorul');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Motorul');
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1,125);
      dx3:=20+textwidth('Diesel');dy3:=40+textheight('Diesel');
      setviewport(x3,y3,x3+dx3,y3+dy3,clipon);
      setfillstyle(1,red);bar(0,0,dx3,dy3);
      rectangle(0,0,dx3,dy3);
      outtextxy(10,10,'Diesel');
      delay(100);
  end;
  setcolor(red);line(0,1,0,dy3-1);
  setviewport(0,0,479,639,clipon);
  setcolor(yellow);
  x:=10;y4:=220;x3:=610;y3:=220;
  for i1:=1 to 26 do
    begin
     x:=x+4;y4:=y4+8;x3:=x3-6;y3:=y3+8;
       settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('functionarea');dy:=40+textheight('functionarea');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'functionarea');
       settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx3:=20+textwidth('Śn 4 timpi');dy3:=40+textheight('Śn 4 timpi');
      setviewport(x3,y3,x3+dx3,y3+dy3,clipon);
      setfillstyle(1,red);bar(0,0,dx3,dy3);
      rectangle(0,0,dx3,dy3);
      outtextxy(10,10,'Śn 4 timpi');
      delay(1);
  end;
   for i1:=27 to 45 do
     begin
       x:=x+1;y4:=y4-11;x3:=x3-5;y3:=y3-11;
        settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('functionarea');dy:=40+textheight('functionarea');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'functionarea');
       settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx3:=20+textwidth('Śn 4 timpi');dy3:=40+textheight('Śn 4 timpi');
      setviewport(x3,y3,x3+dx3,y3+dy3,clipon);
      setfillstyle(1,red);bar(0,0,dx3,dy3);
      rectangle(0,0,dx3,dy3);
      outtextxy(10,10,'Śn 4 timpi');
      delay(1);
  end;
    setcolor(red);
    line(0,1,0,dy3-1);
     setcolor(yellow);
    setviewport(0,0,639,479,clipon);
    delay(5000);
    cleardevice;
    cer;
    setfillstyle(1,red);
    text:='*** realizat de ***';
    lg:=length(text);
    lung:=textwidth(text);inalt:=textheight(text);
    lung1:=150+(lung div 2);inalt1:=200+(inalt div 2);
    fillellipse(lung1,inalt1,((lung+150) div 2)-65,(inalt+200) div 2);
    line(143,200-(inalt div 2),155+lung,200-(inalt div 2));
    line(147,230+(inalt div 2),153+lung,230+(inalt div 2));
    for i1:=1 to 57 do
      begin
        outtextxy(150,200,text);delay(150);
        bar(150,200,150+textwidth(text),200+textheight(text));
        text:=copy(text,2,lg-1)+text[1];
      end;
      outtextxy(150,200,text);
      delay(2000);
    cleardevice;cer;
 x:=0;y4:=0;
 for i1:=1 to 50 do
 begin
      x:=x+2;y4:=y4+8;
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('Micliuc');dy:=40+textheight('Micliuc');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Micliuc');
      delay(1);
   end;
  for i1:=51 to 72 do
    begin
      x:=x+2;y4:=y4-8;
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('Micliuc');dy:=40+textheight('Micliuc');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Micliuc');
      delay(1);
     end;
 x:=594;y4:=0;
   for i1:=1 to 50 do
     begin
       x:=x-2;y4:=y4+8;
      settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=4+textwidth('Timotei');dy:=40+textheight('Timotei');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Timotei');
      delay(1);
   end;
  for i1:=51 to 72 do
    begin
      x:=x-7;y4:=y4-8;
     settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=4+textwidth('Timotei');dy:=40+textheight('Timotei');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Timotei');
      delay(1);
  end;
 setcolor(red);line(0,1,0,dy-1);
 setcolor(yellow);
 delay(5000);
 cleardevice;setviewport(0,0,639,479,clipon);
 cer;setfillstyle(1,black);bar(140,140,500,340);rectangle(141,141,499,339);
 sat('G');sat('R');sat('U');sat('P');sat('U');sat('L');sat('S');sat('C');
 sat('O');sat('L');sat('A');sat('R');
   setcolor(yellow);
  circle(320,240,80);setfillstyle(1,black);
  floodfill(320,240,yellow);
  ellipse(320,235,128,52,120,40);
  pas:=pi*120/180;setcolor(black);
   pas:=pi*130/180;settextstyle(1,0,2);
  for j:=1 to 17 do
  begin
    pas:=pas+pi/18;
    x:=round(320+120*cos(pas));y4:=round(235-40*sin(pas));
    setfillstyle(1,blue);
   fillellipse(x,y4,18,18);outtextxy(x-5,y4-9,'A');
   delay(5);setfillstyle(1,black);fillellipse(x,y4,18,18);
   setcolor(black);ellipse(x,y4,0,360,18,18);
   setcolor(yellow);ellipse(320,235,128,52,120,40);
    circle(320,240,80);
  end;settextstyle(0,0,3);outtextxy(x-5,y4-9,'A');
  delay(1500);
    setcolor(yellow);
  circle(320,240,80);setfillstyle(1,black);
  floodfill(320,240,yellow);
  ellipse(320,235,128,52,120,40);
  pas:=pi*120/180;setcolor(black);
   pas:=pi*130/180;settextstyle(1,0,2);
  for j:=1 to 15 do
  begin
    pas:=pas+pi/18;
    x:=round(320+120*cos(pas));y4:=round(235-40*sin(pas));
    setfillstyle(1,blue);
   fillellipse(x,y4,18,18);outtextxy(x-5,y4-9,'G');
   delay(5);setfillstyle(1,black);fillellipse(x,y4,18,18);
   setcolor(black);ellipse(x,y4,0,360,18,18);
   setcolor(yellow);ellipse(320,235,128,52,120,40);
    circle(320,240,80);
  end;settextstyle(0,0,3);outtextxy(x-5,y4-9,'G');
  delay(1500);
    setcolor(yellow);
  circle(320,240,80);setfillstyle(1,black);
  floodfill(320,240,yellow);
  ellipse(320,235,128,52,120,40);
  pas:=pi*120/180;setcolor(black);
   pas:=pi*130/180;settextstyle(1,0,2);
  for j:=1 to 13 do
  begin
    pas:=pas+pi/18;
    x:=round(320+120*cos(pas));y4:=round(235-40*sin(pas));
    setfillstyle(1,blue);
   fillellipse(x,y4,18,18);outtextxy(x-5,y4-9,'O');
   delay(5);setfillstyle(1,black);fillellipse(x,y4,18,18);
   setcolor(black);ellipse(x,y4,0,360,18,18);
   setcolor(yellow);ellipse(320,235,128,52,120,40);
    circle(320,240,80);
  end;settextstyle(0,0,3);outtextxy(x-5,y4-9,'O');
  delay(1500);
    setcolor(yellow);
  circle(320,240,80);setfillstyle(1,black);
  floodfill(320,240,yellow);
  ellipse(320,235,128,52,120,40);
  pas:=pi*120/180;setcolor(black);
   pas:=pi*130/180;settextstyle(1,0,2);
  for j:=1 to 11 do
  begin
    pas:=pas+pi/18;
    x:=round(320+120*cos(pas));y4:=round(235-40*sin(pas));
    setfillstyle(1,blue);
   fillellipse(x,y4,18,18);outtextxy(x-5,y4-9,'G');
   delay(5);setfillstyle(1,black);fillellipse(x,y4,18,18);
   setcolor(black);ellipse(x,y4,0,360,18,18);
   setcolor(yellow);ellipse(320,235,128,52,120,40);
    circle(320,240,80);
  end;settextstyle(0,0,3);outtextxy(x-5,y4-9,'G');
  delay(1000);
   cleardevice;
  setviewport(0,0,639,479,clipon);cer;
  text:='***sub Śndrumarea***';
  lg:=length(text);lung:=textwidth(text);inalt:=textheight(text);
  setfillstyle(1,blue);
  moveto(85,220);linerel(220,-100);linerel(220,100);
  linerel(-220,100);linerel(-220,-100);
  floodfill(100,220,yellow);
  setfillstyle(1,lightmagenta);setcolor(black);
  settextstyle(1,0,4);
    for i1:=1 to 60 do
      begin
        outtextxy(140,200,text);delay(150);
        bar(140,200,140+textwidth(text),210+textheight(text));
        text:=copy(text,2,lg-1)+text[1];
      end;
  outtextxy(140,200,text);
  delay(2000);
 cleardevice;cer;
 setcolor(yellow);setfillstyle(1,red);
  x:=0;y4:=0;
  for i1:=1 to 50 do
  begin
    x:=x+8;y4:=y4+7;
     settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('profesor');dy:=40+textheight('profesor');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'profesor');
      delay(1);
    end;
  for i1:=51 to 70 do
    begin
    y4:=y4-15;
     settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('profesor');dy:=40+textheight('profesor');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'profesor');
      delay(1);
  end;
  for i1:=71 to 96 do
    begin
      x:=x-10;y4:=y4+3;
     settextstyle(1,0,1);
      setusercharsize(i1*3,125,i1*2,125);
      dx:=20+textwidth('profesor');dy:=40+textheight('profesor');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'profesor');
      delay(1);
  end;
  x:=0;y4:=412;
  for i1:=1 to 20 do
    begin
      x:=x+3;y4:=y4-10;
      settextstyle(1,0,1);
      setusercharsize(i1*14,125,i1*15,125);
      dx:=20+textwidth('Welther Stefan');dy:=40+textheight('Welther Stefan');
      setviewport(x,y4,x+dx,y4+dy,clipon);
      setfillstyle(1,red);bar(0,0,dx,dy);
      rectangle(0,0,dx,dy);
      outtextxy(10,10,'Welther Stefan');
      delay(1);
  end;
  delay(3000);
  setviewport(0,0,639,479,clipon);
  cleardevice;settextstyle(1,0,1);
  setcolor(yellow);setfillstyle(1,red);
  text1:='pt. a Śncepe';
  text2:='ap†sati   <ENTER>';
  fillellipse(101,56,100,55);
  outtextxy(50,25,text1);
  outtextxy(25,55,text2);
  dim:=imagesize(0,0,202,112);
  getmem(p,dim);
  getimage(0,0,202,112,p^);
  x:=1;y4:=1;dx:=-1;dy:=-1;rx:=100;ry:=55;
  repeat
    if (x<1) or (x>(getmaxx-2*rx-3)) then dx:=-dx;
    if (y4<1) or (y4>(getmaxy-2*ry-3)) then dy:=-dy;
    x:=x+dx;y4:=y4+dy;
    putimage(x,y4,p^,normalput);
  until keypressed;
  delay(500);
  cleardevice;
  cer;
  for i1:=1 to 3 do
    begin
      setcolor(yellow);patrat(0,0,639,479,5);
      setcolor(black);patrat(0,0,639,479,5);cer;
    end;
  readkey;
end;
procedure sfarsit;
begin
  setviewport(0,0,639,479,clipoff);setbkcolor(green);cleardevice;
  settextstyle(defaultfont,0,2);setfillstyle(1,green);
  setcolor(yellow);
  x1:=240;c1:='S';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='F';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='A';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='R';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='S';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='I';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='T';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  x1:=x1+textwidth(c1)+5;c1:='!';lit(x1,c1);outtextxy(x1,3*j,c1);delay(50);
  settextjustify(1,0);
  for i1:=1 to 7 do
    begin
      cleardevice;settextstyle(defaultfont,0,i1);delay(10);
      outtextxy(320,270,'SFARSIT!');
      delay(500);
    end;
  closegraph;
end;
procedure red;
begin
settextstyle(0,0,0);
setcolor(8);outtextxy(50,450,'Ap†sati o tast† pentru oprire');
setcolor(11);outtextxy(50,450,'Ap†sati q pentru iesire sau orice alt† tast† pentru continuare');
readkey;
if readkey='q' then sfarsit
else begin
       setcolor(8);outtextxy(50,450,'Ap†sati q pentru iesire sau orice alt† tast† pentru continuare');
       setcolor(11);outtextxy(50,450,'Ap†sati o tast† pentru oprire');
     end;
end;
procedure grafica;
var gd,gm:integer;
begin
  gd:=detect;
  initgraph(gd,gm,'c:\limbaje\tp\bgi');
  if graphresult <> grok then
    begin write('nu e bun† calea la fisierul egavga.bgi ');halt(1);end;
end;
procedure motor;
var i:integer;
begin
setbkcolor(8);
setcolor(10);setlinestyle(0,0,3);setfillstyle(11,8);
line(60,90,139,90);line(161,90,240,90);
line(60,90,60,150);line(240,90,240,150);
bar(80,120,220,360);rectangle(80,120,220,360);
setcolor(8);line(148,120,152,120);line(105,120,125,120);line(175,120,195,120);
setlinestyle(0,0,1);setcolor(4);
line(148,105,148,130);line(152,105,152,130);
line(140,105,148,105);line(152,105,160,105);
line(140,80,140,105);line(160,80,160,105);
setcolor(4);
for i:=1 to 3 do line(141,85+i,159,85+i);
setcolor(10);
for i:=1 to 10 do line(80,140+i,220,140+i);
setcolor(10);
for i:=0 to 7 do line(105,122-i,125,122-i);
setcolor(10);
for i:=0 to 7 do line(175,122-i,195,122-i);
line(104,122,104,123);line(126,122,126,123);
line(104,123,108,123);line(126,123,122,123);
line(174,122,174,123);line(196,122,196,123);
line(174,123,178,123);line(196,123,192,123);
line(114,90,114,120);line(115,90,115,120);line(116,90,116,120);
line(184,90,184,120);line(185,90,185,120);line(186,90,186,120);
settextstyle(0,0,0);
setcolor(11);outtextxy(50,450,'Ap†sati o tast† pentru Śncepere');
readkey;setcolor(8);outtextxy(50,450,'Ap†sati o tast† pentru Śncepere');
setcolor(11);outtextxy(50,450,'Ap†sati o tast† pentru oprire');
end;
procedure desen;
begin
setlinestyle(0,0,3);setcolor(14);
line(400,80,400,280);line(370,250,600,250);
arc(550,100,180,270,100);arc(550,100,180,270,50);
line(450,100,500,100);line(550,150,550,200);
line(390,100,400,80);line(410,100,400,80);
line(580,240,600,250);line(580,260,600,250);
line(450,200,550,200);
settextstyle(1,0,1);
outtextxy(375,85,'P');outtextxy(590,260,'V');
end;
procedure imag;
begin
setbkcolor(8);setcolor(4);line(1,1,10,10);line(1,10,10,1);
dim1:=imagesize(0,0,11,11)+4;getmem(p11,dim1);getimage(1,1,10,10,p11^);
setcolor(8);line(1,1,10,10);line(1,10,10,1);
end;
procedure put(q,j:integer);
begin
case q of
2:begin
    dim2:=imagesize(p1[(j div 2)]-6,194,p1[(j div 2)]+5,205)+4;
    getmem(p12,dim2);getimage(p1[(j div 2)]-5,195,p1[(j div 2)]+4,204,p12^);
    putimage(p1[(j div 2)]-5,195,p11^,0);
    if keypressed then red;
    delay(50);
    putimage(p1[(j div 2)]-5,195,p12^,0);
    freemem(p12,dim2);
  end;
4:begin
    dim2:=imagesize(544+round(100*(cos(pi/2+((pi/2)*j/200)))),94+round(100*(sin(pi/2+((pi/2)*j/200)))),
          555+round(100*(cos(pi/2+((pi/2)*j/200)))),105+round(100*(sin(pi/2+((pi/2)*j/200)))));
    getmem(p12,dim2);
    getimage(545+round(100*(cos(pi/2+((pi/2)*j/200)))),95+round(100*(sin(pi/2+((pi/2)*j/200)))),
          554+round(100*(cos(pi/2+((pi/2)*j/200)))),104+round(100*(sin(pi/2+((pi/2)*j/200)))),p12^);
    putimage(545+round(100*(cos(pi/2+((pi/2)*j/200)))),95+round(100*(sin(pi/2+((pi/2)*j/200)))),p11^,0);
    if keypressed then red;
    delay(50);
    putimage(545+round(100*(cos(pi/2+((pi/2)*j/200)))),95+round(100*(sin(pi/2+((pi/2)*j/200)))),p12^,0);
    freemem(p12,dim2);
  end;
5:begin
    dim2:=imagesize(p1[round((j*50)/12)]-6,94,p1[round((j*50)/12)]+5,105)+4;
    getmem(p12,dim2);getimage(p1[round((j*50)/12)]-5,95,p1[round((j*50)/12)]+4,104,p12^);
    putimage(p1[round((j*50)/12)]-5,95,p11^,0);
    if keypressed then red;
    delay(50);
    putimage(p1[round((j*50)/12)]-5,95,p12^,0);
    freemem(p12,dim2);
  end;
7:begin
    dim2:=imagesize(544+round(50*(cos(pi/2+((pi/2)*(200-j)/200)))),94+round(50*(sin(pi/2+((pi/2)*(200-j)/200)))),
          555+round(50*(cos(pi/2+((pi/2)*(200-j)/200)))),105+round(50*(sin(pi/2+((pi/2)*(200-j)/200)))))+4;
    getmem(p12,dim2);
    getimage(545+round(50*(cos(pi/2+((pi/2)*(200-j)/200)))),95+round(50*(sin(pi/2+((pi/2)*(200-j)/200)))),
             554+round(50*(cos(pi/2+((pi/2)*(200-j)/200)))),104+round(50*(sin(pi/2+((pi/2)*(200-j)/200)))),p12^);
    putimage(545+round(50*(cos(pi/2+((pi/2)*(200-j)/200)))),95+round(50*(sin(pi/2+((pi/2)*(200-j)/200)))),p11^,0);
    if keypressed then red;
    delay(50);
    putimage(545+round(50*(cos(pi/2+((pi/2)*(200-j)/200)))),95+round(50*(sin(pi/2+((pi/2)*(200-j)/200)))),p12^,0);
    freemem(p12,dim2);
  end;
8:begin
    dim2:=imagesize(544,144+round((j*50)/15),555,155+round((j*50)/15))+4;
    getmem(p12,dim2);getimage(545,145+round((j*50)/15),554,154+round((j*50)/15),p12^);
    putimage(545,145+round((j*50)/15),p11^,0);
    if keypressed then red;
    delay(50);
    putimage(545,145+round((j*50)/15),p12^,0);
    freemem(p12,dim2);
  end;
9:begin
    dim2:=imagesize(p1[100-(j div 2)]-6,194,p1[100-(j div 2)]+5,205)+4;
    getmem(p12,dim2);getimage(p1[100-(j div 2)]-5,195,p1[100-(j div 2)]+4,204,p12^);
    putimage(p1[100-(j div 2)]-5,195,p11^,0);
    if keypressed then red;
    delay(50);
    putimage(p1[100-(j div 2)]-5,195,p12^,0);
    freemem(p12,dim2);
  end;
end;
end;
procedure coborare(a,b,c,d,f,e,g:word);
var j:integer;
begin
if q<9 then q:=q+1 else q:=0;
if  linia<5 then linia:=linia+1 else linia:=1;
for j:=1 to (d-b) do
 begin
   setcolor(e);line(a+1,b+j,c-1,b+j);
   setcolor(8);line(a+1,b-f+j,c-1,b-f+j);
   if ((linia=2) or (linia=5)) then
     begin setcolor(e);line(((a+c)div 2)-1,b-f+j,((a+c)div 2)+1,b-f+j);end;
   delay(g);put(q,j);
 end;
end;
procedure urcare(a,b,c,d,f,e,g:word);
var k:integer;
begin
if q<9 then q:=q+1 else q:=0;
for k:=1 to (b-d) do
 begin
   setcolor(e);line(a+1,b-k,c-1,b-k);
   setcolor(8);line(a+1,b+f-k,c-1,b+f-k);
   delay(g);put(q,k);
 end;
end;
procedure t1;
begin
settextstyle(0,0,0);
setcolor(11);outtextxy(50,50,'timpul 1');
urcare(104,116,126,102,7,10,10);
setcolor(11);settextstyle(0,0,0);outtextxy(450,50,'absorbtia');
coborare(81,149,219,350,10,10,10);
setcolor(8);settextstyle(0,0,0);outtextxy(450,50,'absorbtia');
setcolor(8);outtextxy(50,50,'timpul 1');
end;
procedure t2;
begin
settextstyle(0,0,0);
setcolor(11);outtextxy(50,50,'timpul 2');
coborare(104,108,126,122,7,10,10);
setcolor(11);settextstyle(0,0,0);outtextxy(450,50,'compresia');
urcare(81,341,219,140,10,10,10);
setcolor(8);settextstyle(0,0,0);outtextxy(450,50,'compresia');
setcolor(8);outtextxy(50,50,'timpul 2');
end;
procedure t3;
begin
settextstyle(0,0,0);
setcolor(11);outtextxy(50,50,'timpul 3');
setcolor(11);settextstyle(0,0,0);outtextxy(420,50,'injectia si aprinderea');
coborare(140,88,160,100,3,4,10);
setcolor(8);settextstyle(0,0,0);outtextxy(420,50,'injectia si aprinderea');
urcare(140,98,160,86,3,4,10);
setcolor(11);settextstyle(0,0,0);outtextxy(450,50,'detenta');
coborare(81,149,219,350,10,10,10);
setcolor(8);settextstyle(0,0,0);outtextxy(450,50,'detenta');
setcolor(11);settextstyle(0,0,0);outtextxy(380,50,'deschiderea supapei de evacuare');
urcare(174,116,196,101,7,10,10);
setcolor(8);settextstyle(0,0,0);outtextxy(380,50,'deschiderea supapei de evacuare');
setcolor(8);outtextxy(50,50,'timpul 3');
end;
procedure t4;
begin
settextstyle(0,0,0);
setcolor(11);outtextxy(50,50,'timpul 4');
setcolor(11);settextstyle(0,0,0);outtextxy(450,50,'evacuarea');
urcare(81,341,219,140,10,10,10);
setcolor(8);settextstyle(0,0,0);outtextxy(450,50,'evacuarea');
coborare(174,107,196,122,7,10,10);
setcolor(8);outtextxy(50,50,'timpul 4');
end;
begin
te:=0;
grafica;
timi;
cer;
desen;
motor;
imag;
repeat
t1;
t2;
t3;
t4;
until keypressed;
end.