peano1(l,0) peanot(l,0) peano1(l,1) peano1(l,-1)
//peano1(30,0) ou peano1(30,-1) ou peano1(30,1)
peano1(l,s):={
si (s==-1) alors
tourne_droite(45);saute(-l*sqrt(2)/6);rond(round(l*sqrt(2)/6),90);
sinon
si (s==1) alors
tourne_gauche(135);saute(-l*sqrt(2)/6);rond(round(-l*sqrt(2)/6),90);
sinon
tourne_gauche(45);
saute(l*sqrt(2)/6);
fsi;
fsi;
rond(round(l*sqrt(2)/6),90);
rond(round(-l*sqrt(2)/6),270);
rond(round(l*sqrt(2)/6),270);
rond(round(-l*sqrt(2)/6),90);
saute(l*sqrt(2)/6);
tourne_droite(45);
};
//peanot(90,0)
peanot(l,s):={
si (l<31) alors
peano1(l,s);
sinon
si (s==-1) alors
peanot(l/3,-1);
sinon
si (s==1) alors
peanot(l/3,1);
sinon
peanot(l/3,0);
fsi;
fsi;
tourne_droite;peanot(l/3,1);
tourne_gauche;peanot(l/3,-1);
tourne_gauche;peanot(l/3,-1);
tourne_gauche;peanot(l/3,-1);
tourne_droite;peanot(l/3,1);
tourne_droite;peanot(l/3,1);
tourne_droite;peanot(l/3,1);
tourne_gauche;peanot(l/3,-1);
fsi;
};
ou bien en supprimant les saute, les tourne et les
//peano2(30,0) ou peano2(30,-1) ou peano2(30,1)
peano2(l,s):={
si (s==-1) alors
rond(round(l/6),90);
sinon
si (s==1) alors
rond(round(-l/6),90);
fsi;
fsi;
rond(round(l/6),90);
rond(round(-l/6),270);
rond(round(l/6),270);
rond(round(-l/6),90);
};
//tourne_gauche 45;peanot2(90,0,2)
peanot2(l,s,n):={
si (n==1) alors
peano2(l,s);
sinon
si (s==-1) alors
peanot2(l/3,-1,n-1);
sinon
si (s==1) alors
peanot2(l/3,1,n-1);
sinon
peanot2(l/3,0,n-1);
fsi;
fsi;
peanot2(l/3,1,n-1);
peanot2(l/3,-1,n-1);
peanot2(l/3,-1,n-1);
peanot2(l/3,-1,n-1);
peanot2(l/3,1,n-1);
peanot2(l/3,1,n-1);
peanot2(l/3,1,n-1);
peanot2(l/3,-1,n-1);
fsi;
};
Puis on tape par exemple :
//peanot1(90,0,2)
peanot1(l,s,n):={
tourne_gauche 45;
saute(l/2/3^n);
peanot2(l,s,n);
saute(l/2/3^n);
tourne_droite 45;
}
On a :