{************************************************
                 Hugo Eti‚vant
      http://cyberzoide.developpez.com
      
      (pour une aide en Turbo Pascal 7.0)
*************************************************}

uses graph;

procedure carre(n,l,x,y:integer); { n : nombre de carr‚ restant … tracer,
                            l : longeur du c“t‚,
                            x,y : coordonn‚es du d‚but }
begin
if n>0 then
   begin
   moveto(x,y);
   lineto(x+(l div 2),y);
   lineto(x+l,y-(l div 2));
   lineto(x+(l div 2),y-l);
   lineto(x,y-(l div 2));
   lineto(x+(l div 4),y-(l div 4));
   carre(n-1,(l div 2),x+(l div 4),y-(l div 4));
   lineto(x+(l div 2),y); {B}
   lineto(x+l,y);   {C}
   lineto(x+l,y-l); {E}
   lineto(x,y-l); {G}
   lineto(x,y);{A}
   end;
end;

var pilote,mode,n,l,x,y:integer;

BEGIN
pilote:=detect;
initgraph(pilote,mode,'c:\bp\bgi');
n:=6; {nombre de carrés}
l:=479; {longueur du côté du premier carré}
x:=100; y:=1; {coordonnées de départ}
setcolor(15);
carre(n,l,x,480-y);
settextstyle(smallfont,vertdir,6);
outtextxy(20,20,'Programm‚ par Le CyberZo‹de Qui Fr‚tille');
readln;
END.