Old Wood

Keep experimenting with ideas from my "Blurred Fractal" Blurred fractal

Log in to post a comment.

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

function isPrime(n){
	for(let i = 2; i <= Math.floor(Math.sqrt(n)); i++){
		if( n % i === 0){
			return false;
		}
	}
	return true;
}

function walk(i) {
    let y = -100 + i;
    for(let j = 0; j<200; j++)
    {
        let x = -100 + j;
        if (isPrime(Math.floor((i*200 + j)/5))) {
        //if (Math.random()>0.8) {
            turtle.right(Math.sin(i)*10);
        }
        turtle.penup();
        turtle.goto(x, y);
        turtle.pendown();
        turtle.forward(180);
    }
    
    
    return i < 200;
}