first try
Log in to post a comment.
Canvas.setpenopacity(1); const turtle = new Turtle(); let step = 2.4 const SZ = 200 let R1 = 54 let R2 = 36 let h = step * 2.5 function bump(dx) { turtle.left(90) turtle.forward(h) turtle.right(90) turtle.forward(dx) turtle.right(90) turtle.forward(h) turtle.left(90) } for (let y = -100; y <= 100; y += step) { turtle.penup() turtle.goto(-100, y) turtle.pendown() if ((y < -R1) || (y > R1)) { turtle.forward(200) } else if ((y < -R2) || (y > R2)) { rx = Math.sqrt(R1 * R1 - y * y) turtle.forward(SZ/2 - rx) bump(2 * rx) turtle.forward(SZ/2 - rx) } else { rx1 = Math.sqrt(R1 * R1 - y * y) rx2 = Math.sqrt(R2 * R2 - y * y) turtle.forward(SZ/2 - rx1) bump(rx1 - rx2) turtle.forward(2 * rx2) bump(rx1 - rx2) turtle.forward(SZ/2 - rx1) } } /*function walk(i) { turtle.forward(100); turtle.right(144); return i < 4; }*/