Hash
First try
Log in to post a comment.
// Welcome to Turtletoy!
//
// Turtletoy is a community for creative coding. We believe the joy
// is in the craft.
//
// ---------------------------------------------------------------
// A NOTE ON AI:
// Please do not publish code entirely generated by AI.
// We want to see YOUR creativity, your mistakes, and your logic.
// If you use AI to learn, try to rewrite the code yourself before
// sharing, so others can learn from your human approach.
// ---------------------------------------------------------------
//
// API Reference: https://turtletoy.net/syntax
Canvas.setpenopacity(1);
// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(-90,90);
turtle.pendown();
// The walk function will be called until it returns false.
function walk(i) {
if (i == 9) {
turtle.left(90);
}
if (i > 8) {
const j = 17 - i;
turtle.forward(10);
turtle.left(45);
turtle.forward(j * 28.28 + 14.14);
turtle.right(135);
turtle.forward(10);
turtle.right(45);
turtle.forward(j * 28.28);
turtle.left(135);
return i < 17;
}
turtle.forward(10);
turtle.left(135);
turtle.forward(i * 28.28 + 14.14);
turtle.right(45);
turtle.forward(10);
turtle.right(135);
turtle.forward(i * 28.28 + 28.28);
turtle.left(45);
return true;
}