Log in to post a comment.

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();

let th = [0, 0, 0, 0, 0];

// The walk function will be called until it returns false.
function walk(i) {
    for(let i = 0; i < th.length; i++) {
        th[i] = th[i] + i * ((i * 4) / (2 << (i/ 8)));
    }
    
    x = th.reduce((acc, v, i) => acc + Math.sin(v) * 20 / Math.pow(1.0011, i* i), 0)
    y = th.reduce((acc, v, i) => acc + Math.cos(v) * 20 / Math.pow(1.0011, i* i), 0)
    turtle.goto(x, y)
    if(i ==0 ){
        turtle.pendown();
    }
    return i < 1000;
}