repeating tunnel

My first turtle.

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();
turtle.goto(-100,-100);
turtle.pendown();
turtle.goto(100,100);
turtle.penup();
turtle.goto(-100,100);
turtle.pendown();
turtle.goto(100,-100);
// The walk function will be called until it returns false.
function walk(i) {
    z1 = 50/(i+0.7);
    z2 = 50/(i+1.2);
    
    turtle.penup();
    turtle.goto(z1,z1);
    turtle.pendown();
    turtle.goto(-z1, z1);
    turtle.goto(-z1,-z1);
    turtle.goto( z1,-z1);
    turtle.goto( z1, z1);
    
    z3 =-z1;
    z4 = z2;
    
    for (a = 0; a < 4; a++) {
        turtle.penup();
        turtle.goto(z2,z1);
        turtle.pendown();
        turtle.goto(z4,z3);
        
        z5 = z1;
        z1 = z2;
        z2 =-z5;
        z5 = z3;
        z3 = z4;
        z4 =-z5;
    }
    
    
    return i < 100;
}