// Phyllotactic Spiral in TurtleToy

Canvas.setpenopacity(1);
const turtle = new Turtle();

// Constants
const rotation = 32.5;// min=1, max=360, step=0.5 // Angle in degrees
const scale = 3.81; // min=0.01, max=20, step=0.01 // Scaling factor for distance from center
const totalPoints = 596; // min=0.01, max=1000, step=1 // Total number of points in the spiral

// Draw the Phyllotactic Spiral
for (let i = 0; i < totalPoints; i++) {
    const angle = i * rotation;
    const radius = scale * Math.sqrt(i);
    const x = radius * Math.cos(angle * Math.PI / 180);
    const y = radius * Math.sin(angle * Math.PI / 180);

    if (i === 0) {
        turtle.jump(x, y);
    } else {
        turtle.goto(x, y);
    }
}

function loop() {
    return false;
}