Adolecência com o GraFORTH

.

Log in to post a comment.

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

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.radians()
turtle.penup()
const radius = 80.0
const steps = 8192
const xp = Math.floor(steps / 3)
const yp = Math.floor(steps / 3) + 1

function pausecomp(millis)
{
    var date = new Date();
    var curDate = null;
    do { curDate = new Date(); }
    while(curDate-date < millis);
}

function walk(i) {
    x = radius * Math.sin((i * xp * 2.0 * Math.PI) / steps)
    y = radius * Math.sin((i * yp * 2.0 * Math.PI) / steps)
    turtle.goto(x, y)
    if (0 == i) {
        turtle.pendown()
    }
    else {
        pausecomp(1)
    }
    return i < steps
}