Log in to post a comment.

const scale = 100; const iterations = 50000; /* Try changing the value of k and the start coordinate */ const k = 3; const start = [10, 10]; setup(); const turtle = getTurtle(); function walk(i) { turtle.setpos(iterate(turtle.pos())); return i < iterations; } function iterate([x, y]) { [x, y] = [x / scale, y / scale]; return [ Math.sin(k * (y + x)) * scale, Math.sin(k * (y - x)) * scale ]; } function getTurtle () { const turtle = new Turtle(); turtle.penup(); turtle.goto(start); turtle.pendown(); return turtle; } function setup() { Canvas.setpenopacity(0.01); }