Not quite what is on page 38
direct.mit.edu/books…uter-as-a-medium-for
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();
const n = 10; //min=10 max=70 step=1
const angle = 60; //min=60 max=120 step=30
var count = 0;
turtle.penup();
turtle.goto(10,0);
turtle.pendown();
// The walk function will be called until it returns false.
function walk(i) {
subspiro(5,angle,n);
i++;
return i < n;
}
function subspiro (side, angle, max){
count = 1;
turtle.pendown();
for (var i = 0; i < max; i++) {
step = side * count;
turtle.right(angle);
count = count + 1;
turtle.forward(step);
}
}