Burning Ship Fractal

I'm really bad at this, I'm sure someone with more time could figure out a better way to do a #fractal , but I drew it similar to how a crt scans a screen. I just like fractals tho :P

Log in to post a comment.

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

// Global code will be evaluated once.
const turtle = new Turtle();
turtle.penup();
turtle.goto(-100,-100);


// The walk function will be called until it returns false.
function walk(i) {
    var x=i%200-100;
    var y=i/200-100;
    
    
    var ix = x/2500.0-1.76;
    var iy = y/2500.0-0.03;
    
    var zx = ix;
    var zy = iy;
    
    var iteration = 0;
    var max_iteration = 21;
    
    while (zx*zx + zy*zy < 4  &&  iteration < max_iteration) 
    {
        var xtemp = zx*zx - zy*zy + ix;
        zy = Math.abs(2*zx*zy) + iy;
        zx = Math.abs(xtemp);
        
        iteration = iteration + 1
    }
    if (iteration == max_iteration){
    
    //console.log(x,y)
    turtle.goto(x,y)
    turtle.pendown()
    turtle.forward(1)
    turtle.backward(1)
    //turtle.circle(1,360)
    turtle.penup()
    
    }
    
    return i<200*200
}