Fichier islandsA.mp (figure 1) — Modifié le 15 Février 2003 à 19 h 18

islandsA.mp (figure 1)
Source

input tortue;

vardef trace(expr a,b) =
   draw a--b withpen pencircle scaled 2pt
             withcolor (1,1,0);
enddef;

vardef deplace(expr a,b) =
enddef;

vardef F(expr n,m) =
   if m>0:
        F(n,m-1);
        tourne(n,90);
        f(n,m-1);
        tourne(n,-90);
        F(n,m-1);
        F(n,m-1);
        tourne(n,90);
        F(n,m-1);
        tourne(n,90);
        F(n,m-1);
        F(n,m-1);
        tourne(n,90);
        F(n,m-1);
        f(n,m-1);
        tourne(n,90);
        F(n,m-1);
        F(n,m-1);
        tourne(n,-90);
        f(n,m-1);
        tourne(n,90);
        F(n,m-1);
        F(n,m-1);
        tourne(n,-90);
        F(n,m-1);
        tourne(n,-90);
        F(n,m-1);
        F(n,m-1);
        tourne(n,-90);
        F(n,m-1);
        f(n,m-1);
        tourne(n,-90);
        F(n,m-1);
        F(n,m-1);
        F(n,m-1);
   else:
        avance(n,longueur,trace);
   fi
enddef;

vardef f(expr n,m) =
   if m>0:
        f(n,m-1);
        f(n,m-1);
        f(n,m-1);
        f(n,m-1);
        f(n,m-1);
        f(n,m-1);
   else:
        avance(n,longueur,deplace);
   fi
enddef;

vardef axiome(expr n,m) =
        F(n,m);
        tourne(n,90);
        F(n,m);
        tourne(n,90);
        F(n,m);
        tourne(n,90);
        F(n,m);
enddef;

picture lsystem;
path cadre;


beginfig(1);
    longueur = 236 / ( 6 ** 2 );
    tortue(1,118,-118,90,1);
    lsystem = image(
        axiome(1,2);
        );
    cadre = bbox(lsystem);
    fill cadre withcolor (.4,.4,1);
    draw lsystem;        
endfig;
end