// Global code will be evaluated once. const turtle = new Turtle(); // The walk function will be called until it returns false. function walk(i) { if(i == 0) { turtle.forward(50); turtle.left(45); turtle.forward(25); turtle.left(135); turtle.forward(75); turtle.right(45); turtle.forward(15); turtle.backward(15); turtle.left(45); turtle.forward(50); turtle.left(135); turtle.forward(25); turtle.left(45); turtle.forward(10); turtle.right(90); turtle.forward(10); turtle.backward(10); turtle.left(90); turtle.forward(30); turtle.penup(); turtle.forward(100); turtle.left(90); turtle.forward(5); turtle.right(90); turtle.pendown(); } else { if(i % 2 == 0) { turtle.left(90); turtle.circle(10, 180); turtle.right(90); } else { turtle.right(90); turtle.circle(10, 180); turtle.left(90); } } return i < 12; }