PatternTiles1

Patterned Tiles

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(-95,-95);
turtle.pendown();

function square(s,t) {

    turtle.setheading(0);
    turtle.right(t);
    turtle.penup();
    turtle.back(s/2);
    turtle.left(90);
    turtle.forward(s/2);
    turtle.setheading(0);
    turtle.pendown();
    turtle.right(t);
    turtle.forward(s);
    turtle.right(90);
    turtle.forward(s);
    turtle.right(90);
    turtle.forward(s);
    turtle.right(90);
    turtle.forward(s);
    turtle.right(90);
}
// The walk function will be called until it returns false.
function walk(n) {
    i = n%20;
    j = (n-i)/20;
    turtle.jmp(-95+i*10,-95+j*10);
    square(10,.2*(i*j));
    return n < 400;
}