Fibonacci word/fractal: Difference between revisions

Content added Content deleted
(added two notes (warnings) that clicking on the mention (or inferred) website leaves a cookie.)
No edit summary
Line 1,619:
 
main()</lang>
 
=={{header|Processing}}==
Written in Processing (www.processing.org)
 
<lang processing>
int n = 18;
String f1 = "1";
String f2 = "0";
String f3;
 
 
void setup(){
size(600,600);
background(255);
translate(10, 10);
createSeries();
}
 
void createSeries(){
for(int i=0; i<n; i++){
f3 = f2+f1;
f1 = f2;
f2 = f3;
}
drawFractal();
}
 
void drawFractal(){
char[] a = f3.toCharArray();
for(int i=0; i<a.length; i++){
if(a[i]=='0'){
if(i%2==0){
rotate(PI/2);
}
else{
rotate(-PI/2);
}
}
line(0,0,2,0);
translate(2,0);
}
}
</lang>
 
=={{header|Python}}==