Log in to post a comment.

// Forked from "Spirolateral 003" by rupertxrussell
// https://turtletoy.net/turtle/d5cefb90ea

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(1);

// inspired by https://direct.mit.edu/books/oa-monograph/4663/Turtle-GeometryThe-Computer-as-a-Medium-for
// Turtle Geometry: The Computer as a Medium for Exploring Mathematics 
// Harold Abelson, Andrea diSessa
// The MIT Press
// DOI: https://doi.org/10.7551/mitpress/6933.001.0001
// ISBN electronic: 9780262362740
// Publication date: 1981

// Global code will be evaluated once.
const turtle = new Turtle();
var n = 9; // //min=9 max=34 step=1
const scale = 5;// // min=1 max=6 step=1

const angle = 90; // //min=60 max=120 step=30
const index = 0;
var count = 0;
n = 9;
turtle.jump(-90,-90); for(var iter = 0; iter < n; iter ++){ subgspiro(2,angle,n, 3, 4, 5);}

n = 11;
turtle.jump(-50,-70); for(var iter = 0; iter < n; iter ++){ subgspiro(1.7,angle,n, 3, 4, 5);}

n = 12;
turtle.jump(8,-75); for(var iter = 0; iter < n; iter ++){ subgspiro(1.7,angle,n, 3, 4, 5);}

n = 13;
turtle.jump(40,-73); for(var iter = 0; iter < n; iter ++){ subgspiro(1.7,angle,n, 3, 4, 5);}

n = 15;
turtle.jump(75,-93); for(var iter = 0; iter < n; iter ++){ subgspiro(1.2,angle,n, 3, 4, 5);}

n = 16;
turtle.jump(-90,-56); for(var iter = 0; iter < n; iter ++){ subgspiro(1.2,angle,n, 3, 4, 5);}

n = 17;
turtle.jump(-47,-58); for(var iter = 0; iter < n; iter ++){ subgspiro(1.2,angle,n, 3, 4, 5);}

n = 19;
turtle.jump(-8,-38); for(var iter = 0; iter < n; iter ++){ subgspiro(1,angle,n, 3, 4, 5);}

n = 20;
turtle.jump(43,-42); for(var iter = 0; iter < n; iter ++){ subgspiro(1,angle,n, 3, 4, 5);}

n = 21;
turtle.jump(75,-42); for(var iter = 0; iter < n; iter ++){ subgspiro(0.9,angle,n, 3, 4, 5);}

n = 23;
turtle.jump(-75,-22); for(var iter = 0; iter < n; iter ++){ subgspiro(0.7,angle,n, 3, 4, 5);}

n = 24;
turtle.jump(-49,-20); for(var iter = 0; iter < n; iter ++){ subgspiro(0.79,angle,n, 3, 4, 5);}

n = 25;
turtle.jump(-5,-22); for(var iter = 0; iter < n; iter ++){ subgspiro(0.7,angle,n, 3, 4, 5);}

n = 27;
turtle.jump(31,-5); for(var iter = 0; iter < n; iter ++){ subgspiro(0.65,angle,n, 3, 4, 5);}

n = 28;
turtle.jump(79,-07); for(var iter = 0; iter < n; iter ++){ subgspiro(0.7,angle,n, 3, 4, 5);}

n = 29;
turtle.jump(-75, 30); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 31;
turtle.jump(-35, 10); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 32;
turtle.jump(-8, 15); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 33;
turtle.jump(30, 15); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 35;
turtle.jump(70, 37); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 36;
turtle.jump(-70, 74); for(var iter = 0; iter < n; iter ++){ subgspiro(0.67,angle,n, 3, 4, 5);}

n = 37;
turtle.jump(-30, 75); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 39;
turtle.jump(21, 55); for(var iter = 0; iter < n; iter ++){ subgspiro(0.6,angle,n, 3, 4, 5);}

n = 40;
turtle.jump(61, 62); for(var iter = 0; iter < n; iter ++){ subgspiro(0.7,angle,n, 3, 4, 5);}



function subgspiro (side, angle, max, a, b, c){
    count = 1;
    turtle.pendown();
    
    for (var i = 0; i < max; i++) {
        step = side * count;
        turtle.forward(step);
        if((count == a) || (count == b) || count==c){
            turtle.left(angle);   
        }
        else{
            turtle.right(angle);
        }
        count ++;
    }
}
   // turtle.right(angle);
    count = count + 1;