yea
Log in to post a comment.
// You can find the Turtle API reference here: https://turtletoy.net/syntax Canvas.setpenopacity(-0.1); // Global code will be evaluated once. const turtle = new Turtle(); turtle.pendown(); x=-100 y=-100 samples=5 j=0 const xvals=[] const yvals=[] while(j<samples){ x=-100 while(x<100){ y=-100 while(y<100){ zx=x+Math.random()*2-1 zy=y+Math.random()*2-1 zx=zx/100 zy=zy/100 zx0=zx zy0=zy iter=0 while(iter<100){ if((zx*zx)+(zy*zy)>4){break;} zxt=(zx*zx)-(zy*zy)+zx0 zy=2*(zx*zy)+zy0 zx=zxt iter++ } if(iter!=100){ xvals.push(zx0) yvals.push(zy0) } y++ } x++ } j++ } // The walk function will be called until it returns false. function walk(i) { k=0 while(k<xvals.length){ zx=xvals[k] zy=yvals[k] zx0=zx zy0=zy j=0 while(j<i+1){ zxt=(zx*zx)-(zy*zy)+zx0 zy=2*(zx*zy)+zy0 zx=zxt j++ } turtle.jump(zx*100,zy*100) turtle.circle(0.1) k++ } return i<10 }