Not Random Walk

I remember now, it's Fibonacci!

Log in to post a comment.

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

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.up()
turtle.right(90)
turtle.setx(-45)
turtle.sety(45)
turtle.down()

past = 0
now  = 1

// The walk function will be called until it returns false.
function walk(i) {
    next = now + past
    past = now
    now  = next
    turtle.forward(Math.sin(next)*Math.cos(next)*15)
    turtle.right(120)
    return i < 1500;
}