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

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

u = 0.928
//u = 0.8
n_trajectories = 200


function walk(i) {
    
    /*
    // NOTE: This is what is making it look strange. If you keep u fixed, it is a normal sprial thing.
    if(i%20==0){
        u = u + 0.05
    }
    */
    
    x = 15* (Math.random() - Math.random())
    y = 15* (Math.random() - Math.random())
    
    turtle.goto(10*x, 10*y);
    turtle.down()
    
    for(let s=0; s<1000;s++){
        
        t = 0.4 - 6/(1+x*x+y*y)
        
        xn = 1+u*(x*Math.cos(t)-y*Math.sin(t))
        yn = u*(x*Math.sin(t)+y*Math.cos(t))
        
        x = xn
        y = yn
        turtle.goto(10*x, 10*y);
        
    }
    turtle.penup();
    

    return i < n_trajectories
}