Log in to post a comment.

// Forked from "Spirolateral 003 hard coded" by rupertxrussell
// https://turtletoy.net/turtle/29012795ff

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

// You can find the Turtle API reference here: https://turtletoy.net/syntax

// 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

//Excel files used to process X, Y coordinates at: https://rupert.id.au/spirolateral003

// Todo  There are still some lines that are composits of 2 or 3 shorter lines
// I intend to replace these with a single full length line to reduce the number
// of pen lifts when plotting. For example see: steps 27,28 & 29 also 31 & 32. https://turtletoy.net/turtle/3abf25536a#step=32,plotterVersion=1

const x=-15;  // // min=-100 max=100 step=1
const y=21; // // min=-100 max=100 step=1
const scale=1.1 // //min=0.5 max=1.1 step=0.1

const x2=-48; // // min=-100 max=100 step=1
const y2=12; // // min=-100 max=100 step=1
const scale2=2.2 // //min=0.5 max=3.1 step=0.1

const step=117; // min=0 max=117 step=1 
const turtle = new Turtle();
const angle = 90; 
const n = 39; // //min=9 max=39 step=1

const fineTune =0; // //min=-10 max=10 step=1
const plotterVersion=1;  //min=0 max=1 step=1 (Duplicate lines, Hardcoded minimum lines (Steps enabled))
// const a=-0;  // min=-100 max=100 step=1

// You can find the Turtle API reference here: https://turtletoy.net/syntax
Canvas.setpenopacity(plotterVersion == 1? 1: 1);  // toggle black or white background

var step2 = step + fineTune;

    turtle.penup();
    turtle.goto(x2,-y2);
    turtle.pendown();
    
    if (plotterVersion ==1){ 
        hardCode();
    }

// The walk function will be called until it returns false.

function walk(i) {
    if(i == 0){
    turtle.penup();
    turtle.goto(x2,-y2);
    turtle.pendown();
    }
    
    if (plotterVersion == 0){ 
      subgspiro(scale2,angle,n, 3, 4, 5);
    }
    i++;
    return i < n;
}
    
function subgspiro (side, angle, max, a, b, c ){
    
var count = 1;
    
    for (var i = 0; i < max; i++) {
        step2 = side * count;
        turtle.forward(step2);
        if((count == a) || (count == b) || count==c){
            turtle.left(angle);   
        }
        else{
            turtle.right(angle);
        }
        count ++;
    }
}
    
function hardCode(){
    
if (step2>=1){ turtle.jump((scale * -56) + x, (scale * -62) + y) ;turtle.goto((scale * -56) + x, (scale * 14) + y);}
if (step2>=2){ turtle.jump((scale * -52) + x, (scale * 10) + y) ;turtle.goto((scale * -52) + x, (scale * -58) + y);}
if (step2>=3){ turtle.jump((scale * -48) + x, (scale * -54) + y) ;turtle.goto((scale * -48) + x, (scale * 6) + y);}
if (step2>=4){ turtle.jump((scale * -44) + x, (scale * 2) + y) ;turtle.goto((scale * -44) + x, (scale * -50) + y);}
if (step2>=5){ turtle.jump((scale * -40) + x, (scale * -46) + y) ;turtle.goto((scale * -40) + x, (scale * -2) + y);}
if (step2>=6){ turtle.jump((scale * -36) + x, (scale * -6) + y) ;turtle.goto((scale * -36) + x, (scale * -42) + y);}
if (step2>=7){ turtle.jump((scale * -34) + x, (scale * -26) + y) ;turtle.goto((scale * -34) + x, (scale * -18) + y);}
if (step2>=8){ turtle.jump((scale * -32) + x, (scale * -10) + y) ;turtle.goto((scale * -32) + x, (scale * -38) + y);}
if (step2>=9){ turtle.jump((scale * -30) + x, (scale * -30) + y) ;turtle.goto((scale * -30) + x, (scale * 48) + y);}
if (step2>=10){ turtle.jump((scale * -28) + x, (scale * -14) + y) ;turtle.goto((scale * -28) + x, (scale * -34) + y);}
if (step2>=11){ turtle.jump((scale * -26) + x, (scale * -26) + y) ;turtle.goto((scale * -26) + x, (scale * 44) + y);}
if (step2>=12){ turtle.jump((scale * -24) + x, (scale * -18) + y) ;turtle.goto((scale * -24) + x, (scale * -30) + y);}
if (step2>=13){ turtle.jump((scale * -22) + x, (scale * -88) + y) ;turtle.goto((scale * -22) + x, (scale * 40 ) + y);}
if (step2>=14){ turtle.jump((scale * -18) + x, (scale * 36) + y) ;turtle.goto((scale * -18) + x, (scale * -84) + y);}
if (step2>=15){ turtle.jump((scale * -14) + x, (scale * -80) + y) ;turtle.goto((scale * -14) + x, (scale * -22) + y);}
if (step2>=16){ turtle.jump((scale * -14) + x, (scale * -14) + y); turtle.goto((scale * -14) + x, (scale * 32) + y);}
if (step2>=17){ turtle.jump((scale * -10) + x, (scale * 28) + y) ;turtle.goto((scale * -10) + x, (scale * -10) + y);}
if (step2>=18){ turtle.jump((scale * -10) + x, (scale * -14) + y) ;turtle.goto((scale * -10) + x, (scale * -76) + y);}
if (step2>=19){ turtle.jump((scale * -6) + x, (scale * -72) + y) ;turtle.goto((scale * -6) + x, (scale * -10) + y);}
if (step2>=20){ turtle.jump((scale * -6) + x, (scale * -6) + y); turtle.goto((scale * -6) + x, (scale * 24) + y);}
if (step2>=21){ turtle.jump((scale * -2) + x, (scale * 20) + y) ;turtle.goto((scale * -2) + x, (scale * -2) + y);}
if (step2>=22){ turtle.jump((scale * -2) + x, (scale * -6) + y); turtle.goto((scale * -2) + x, (scale * -68) + y);}
if (step2>=23){ turtle.jump((scale * 2) + x, (scale * -64) + y) ;turtle.goto((scale * 2) + x, (scale * -2) + y);}
if (step2>=24){ turtle.jump((scale * 2) + x, (scale * 2) + y) ;turtle.goto((scale * 2) + x, (scale * 16) + y);}
if (step2>=25){ turtle.jump((scale * 2) + x, (scale * 20) + y) ;turtle.goto((scale * 2) + x, (scale * 22) + y);}
if (step2>=26){ turtle.jump((scale * 6) + x, (scale * 26) + y) ;turtle.goto((scale * 6) + x, (scale * 20) + y);}
if (step2>=27){ turtle.jump((scale * 6) + x, (scale * 18) + y) ;turtle.goto((scale * 6) + x, (scale * -60) + y);}
if (step2>=28){ turtle.jump((scale * 10) + x, (scale * -66) + y) ;turtle.goto((scale * 10) + x, (scale * -56) + y);}
if (step2>=29){ turtle.jump((scale * 10) + x, (scale * -50) + y) ;turtle.goto((scale * 10) + x, (scale * 14) + y);}
if (step2>=30){ turtle.jump((scale * 14) + x, (scale * 26) + y) ;turtle.goto((scale * 14) + x, (scale * 16) + y);}
if (step2>=31){ turtle.jump((scale * 14) + x, (scale * 10) + y) ;turtle.goto((scale * 14) + x, (scale * -54) + y);}
if (step2>=32){ turtle.jump((scale * 18) + x, (scale * -66) + y) ;turtle.goto((scale * 18) + x, (scale * -60) + y);}
if (step2>=33){ turtle.jump((scale * 18) + x, (scale * -58) + y) ;turtle.goto((scale * 18) + x, (scale * 20) + y);}
if (step2>=36){ turtle.jump((scale * 22) + x, (scale * 24) + y) ;turtle.goto((scale * 22) + x, (scale * -38) + y);}
if (step2>=35){ turtle.jump((scale * 22) + x, (scale * -56) + y) ;turtle.goto((scale * 22) + x, (scale * -42) + y);}
if (step2>=34){ turtle.jump((scale * 22) + x, (scale * -60) + y) ;turtle.goto((scale * 22) + x, (scale * -62) + y);}
if (step2>=37){ turtle.jump((scale * 26) + x, (scale * -60) + y) ;turtle.goto((scale * 26) + x, (scale * -38) + y);}
if (step2>=38){ turtle.jump((scale * 26) + x, (scale * -34) + y) ;turtle.goto((scale * 26) + x, (scale * 28) + y);}
if (step2>=39){ turtle.jump((scale * 30) + x, (scale * 32) + y) ;turtle.goto((scale * 30) + x, (scale * -30) + y);}
if (step2>=40){ turtle.jump((scale * 30) + x, (scale * -34) + y) ;turtle.goto((scale * 30) + x, (scale * -64) + y);}
if (step2>=41){ turtle.jump((scale * 34) + x, (scale * -68) + y) ;turtle.goto((scale * 34) + x, (scale * -30) + y);}
if (step2>=42){ turtle.jump((scale * 34) + x, (scale * -26) + y) ;turtle.goto((scale * 34) + x, (scale * 36) + y);}
if (step2>=43){ turtle.jump((scale * 38) + x, (scale * 40) + y) ;turtle.goto((scale * 38) + x, (scale * -18) + y);}
if (step2>=44){ turtle.jump((scale * 38) + x, (scale * -26) + y) ;turtle.goto((scale * 38) + x, (scale * -72) + y);}
if (step2>=45){ turtle.jump((scale * 42) + x, (scale * -76) + y) ;turtle.goto((scale * 42) + x, (scale * 44) + y);}
if (step2>=46){ turtle.jump((scale * 46) + x, (scale * 48) + y) ;turtle.goto((scale * 46) + x, (scale * -80) + y);}
if (step2>=47){ turtle.jump((scale * 48) + x, (scale * -22) + y) ;turtle.goto((scale * 48) + x, (scale * -10) + y);}
if (step2>=48){ turtle.jump((scale * 50) + x, (scale * -14) + y) ;turtle.goto((scale * 50) + x, (scale * -84) + y);}
if (step2>=49){ turtle.jump((scale * 52) + x, (scale * -26) + y) ;turtle.goto((scale * 52) + x, (scale * -6) + y);}
if (step2>=50){ turtle.jump((scale * 54) + x, (scale * -10) + y) ;turtle.goto((scale * 54) + x, (scale * -88) + y);}
if (step2>=51){ turtle.jump((scale * 56) + x, (scale * -30) + y) ;turtle.goto((scale * 56) + x, (scale * -2) + y);}
if (step2>=52){ turtle.jump((scale * 58) + x, (scale * -14) + y) ;turtle.goto((scale * 58) + x, (scale * -22) + y);}
if (step2>=53){ turtle.jump((scale * 60) + x, (scale * -34) + y) ;turtle.goto((scale * 60) + x, (scale * 2) + y);}
if (step2>=54){ turtle.jump((scale * 64) + x, (scale * 6) + y) ;turtle.goto((scale * 64) + x, (scale * -38) + y);}
if (step2>=55){ turtle.jump((scale * 68) + x, (scale * -42) + y) ;turtle.goto((scale * 68) + x, (scale * 10) + y);}
if (step2>=56){ turtle.jump((scale * 72) + x, (scale * 14) + y) ;turtle.goto((scale * 72) + x, (scale * -46) + y);}
if (step2>=57){ turtle.jump((scale * 76) + x, (scale * -50) + y) ;turtle.goto((scale * 76) + x, (scale * 18) + y);}
if (step2>=58){ turtle.jump((scale * 80) + x, (scale * 22) + y) ;turtle.goto((scale * 80) + x, (scale * -54) + y);}
if (step2>=59){ turtle.jump((scale * -22) + x, (scale * -88) + y) ;turtle.goto((scale * 54) + x, (scale * -88) + y);}




if (step2>=60){ turtle.jump((scale * 50) + x, (scale * -84) + y) ;turtle.goto((scale * -18) + x, (scale * -84) + y);}
if (step2>=61){ turtle.jump((scale * -14) + x, (scale * -80) + y) ;turtle.goto((scale * 46) + x, (scale * -80) + y);}
if (step2>=62){ turtle.jump((scale * 42) + x, (scale * -76) + y) ;turtle.goto((scale * -10) + x, (scale * -76) + y);}
if (step2>=63){ turtle.jump((scale * -6) + x, (scale * -72) + y) ;turtle.goto((scale * 38) + x, (scale * -72) + y);}
if (step2>=64){ turtle.jump((scale * 34) + x, (scale * -68) + y) ;turtle.goto((scale * -2) + x, (scale * -68) + y);}
if (step2>=65){ turtle.jump((scale * 10) + x, (scale * -66) + y) ;turtle.goto((scale * 18) + x, (scale * -66) + y);}
if (step2>=66){ turtle.jump((scale * 30) + x, (scale * -64) + y) ;turtle.goto((scale * 2) + x, (scale * -64) + y);}
if (step2>=67){ turtle.jump((scale * -56) + x, (scale * -62) + y) ;turtle.goto((scale * 22) + x, (scale * -62) + y);}
if (step2>=68){ turtle.jump((scale * 26) + x, (scale * -60) + y) ;turtle.goto((scale * 6) + x, (scale * -60) + y);}
if (step2>=69){ turtle.jump((scale * -52) + x, (scale * -58) + y) ;turtle.goto((scale * 18) + x, (scale * -58) + y);}
if (step2>=70){ turtle.jump((scale * 22) + x, (scale * -56) + y) ;turtle.goto((scale * 10) + x, (scale * -56) + y);}
if (step2>=71){ turtle.jump((scale * -48) + x, (scale * -54) + y) ;turtle.goto((scale * 80) + x, (scale * -54) + y);}
if (step2>=72){ turtle.jump((scale * 76) + x, (scale * -50) + y) ;turtle.goto((scale * -44) + x, (scale * -50) + y);}
if (step2>=73){ turtle.jump((scale * -40) + x, (scale * -46) + y) ;turtle.goto((scale * 6) + x, (scale * -46) + y);}
if (step2>=74){ turtle.jump((scale * 14) + x, (scale * -46) + y) ;turtle.goto((scale * 72) + x, (scale * -46) + y);}
if (step2>=75){ turtle.jump((scale * 68) + x, (scale * -42) + y) ;turtle.goto((scale * 6) + x, (scale * -42) + y);}
if (step2>=76){ turtle.jump((scale * 2) + x, (scale * -42) + y) ;turtle.goto((scale * -36) + x, (scale * -42) + y);}
if (step2>=77){ turtle.jump((scale * -32) + x, (scale * -38) + y) ;turtle.goto((scale * -2) + x, (scale * -38) + y);}
if (step2>=78){ turtle.jump((scale * 2) + x, (scale * -38) + y) ;turtle.goto((scale * 64) + x, (scale * -38) + y);}
if (step2>=79){ turtle.jump((scale * 60) + x, (scale * -34) + y) ;turtle.goto((scale * -2) + x, (scale * -34) + y);}
if (step2>=80){ turtle.jump((scale * -6) + x, (scale * -34) + y) ;turtle.goto((scale * -28) + x, (scale * -34) + y);}
if (step2>=81){ turtle.jump((scale * -30) + x, (scale * -30) + y) ;turtle.goto((scale * -28) + x, (scale * -30) + y);}
if (step2>=82){ turtle.jump((scale * -24) + x, (scale * -30) + y) ;turtle.goto((scale * -10) + x, (scale * -30) + y);}
if (step2>=83){ turtle.jump((scale * -6) + x, (scale * -30) + y) ;turtle.goto((scale * 56) + x, (scale * -30) + y);}
if (step2>=84){ turtle.jump((scale * 56) + x, (scale * -26) + y) ;turtle.goto((scale * -26) + x, (scale * -26) + y);}
if (step2>=85){ turtle.jump((scale * -28) + x, (scale * -26) + y) ;turtle.goto((scale * -34) + x, (scale * -26) + y);}
if (step2>=87){ turtle.jump((scale * -22) + x, (scale * -22) + y) ;turtle.goto((scale * 42) + x, (scale * -22) + y);}
if (step2>=88){ turtle.jump((scale * 48) + x, (scale * -22) + y) ;turtle.goto((scale * 58) + x, (scale * -22) + y);}
if (step2>=89){ turtle.jump((scale * 46) + x, (scale * -18) + y) ;turtle.goto((scale * -18) + x, (scale * -18) + y);}
if (step2>=90){ turtle.jump((scale * -24) + x, (scale * -18) + y) ;turtle.goto((scale * -34) + x, (scale * -18) + y);}
if (step2>=91){ turtle.jump((scale * -28) + x, (scale * -14) + y) ;turtle.goto((scale * 50) + x, (scale * -14) + y);}
if (step2>=92){ turtle.jump((scale * 52) + x, (scale * -14) + y) ;turtle.goto((scale * 58) + x, (scale * -14) + y);}if (step2>=95){ turtle.jump((scale * 54) + x, (scale * -10) + y) ;turtle.goto((scale * 52) + x, (scale * -10) + y);}
if (step2>=93){ turtle.jump((scale * 48) + x, (scale * -10) + y) ;turtle.goto((scale * 34) + x, (scale * -10) + y);}
if (step2>=94){ turtle.jump((scale * 30) + x, (scale * -10) + y) ;turtle.goto((scale * -32) + x, (scale * -10) + y);}
if (step2>=96){ turtle.jump((scale * -36) + x, (scale * -6) + y) ;turtle.goto((scale * 26) + x, (scale * -6) + y);}
if (step2>=97){ turtle.jump((scale * 30) + x, (scale * -6) + y) ;turtle.goto((scale * 52) + x, (scale * -6) + y);}
if (step2>=98){ turtle.jump((scale * 56) + x, (scale * -2) + y) ;turtle.goto((scale * 26) + x, (scale * -2) + y);}
if (step2>=99){ turtle.jump((scale * 22) + x, (scale * -2) + y) ;turtle.goto((scale * -40) + x, (scale * -2) + y);}
if (step2>=100){ turtle.jump((scale * -44) + x, (scale * 2) + y) ;turtle.goto((scale * 18) + x, (scale * 2) + y);}
if (step2>=101){ turtle.jump((scale * 22) + x, (scale * 2) + y) ;turtle.goto((scale * 60) + x, (scale * 2) + y);}
if (step2>=102){ turtle.jump((scale * 64) + x, (scale * 6) + y) ;turtle.goto((scale * 18) + x, (scale * 6) + y);}
if (step2>=103){ turtle.jump((scale * 10) + x, (scale * 6) + y) ;turtle.goto((scale * -48) + x, (scale * 6) + y);}
if (step2>=104){ turtle.jump((scale * -52) + x, (scale * 10) + y) ;turtle.goto((scale * 68) + x, (scale * 10) + y);}
if (step2>=105){ turtle.jump((scale * 72) + x, (scale * 14) + y) ;turtle.goto((scale * -56) + x, (scale * 14) + y);}
if (step2>=106){ turtle.jump((scale * 2) + x, (scale * 16) + y) ;turtle.goto((scale * 14) + x, (scale * 16) + y);}
if (step2>=107){ turtle.jump((scale * 76) + x, (scale * 18) + y) ;turtle.goto((scale * 6) + x, (scale * 18) + y);}
if (step2>=108){ turtle.jump((scale * -2) + x, (scale * 20) + y) ;turtle.goto((scale * 18) + x, (scale * 20) + y);}
if (step2>=109){ turtle.jump((scale * 2) + x, (scale * 22) + y) ;turtle.goto((scale * 80) + x, (scale * 22) + y);}
if (step2>=110){ turtle.jump((scale * 22) + x, (scale * 24) + y) ;turtle.goto((scale * -6) + x, (scale * 24) + y);}
if (step2>=111){ turtle.jump((scale * 6) + x, (scale * 26) + y) ;turtle.goto((scale * 14) + x, (scale * 26) + y);}
if (step2>=112){ turtle.jump((scale * 26) + x, (scale * 28) + y) ;turtle.goto((scale * -10) + x, (scale * 28) + y);}
if (step2>=113){ turtle.jump((scale * -14) + x, (scale * 32) + y) ;turtle.goto((scale * 30) + x, (scale * 32) + y);}
if (step2>=114){ turtle.jump((scale * 34) + x, (scale * 36) + y) ;turtle.goto((scale * -18) + x, (scale * 36) + y);}
if (step2>=115){ turtle.jump((scale * -22) + x, (scale * 40) + y) ;turtle.goto((scale * 38) + x, (scale * 40) + y);}
if (step2>=116){ turtle.jump((scale * 42) + x, (scale * 44) + y) ;turtle.goto((scale * -26) + x, (scale * 44) + y);}
if (step2>=117){ turtle.jump((scale * -30) + x, (scale * 48) + y) ;turtle.goto((scale * 46) + x, (scale * 48) + y);}
}