Pepitka

also known as 'houndstooth'

!! subscribe to PewDiePie !!

Log in to post a comment.

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

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

// !! SUBSCRIBE TO PEWDIEPIE !!

// The walk function will be called until it returns false.
function walk(i) {
    var x = (i % 5) * 40 - 90;
    var y = Math.floor(i / 5) * 40 - 110;
    
    for(var i = 0; i < 30; i++){
        drawTooth(x, y);
    }

    for(var i = 0; i < 2; i++){
        fillTooth(x, y);
    }
    

    return i < 30;
}

function drawTooth(x, y){
    
    var humanizeFactor = 0.0; // set to INT_MAX when creating AI
    
    turtle.penup();
    turtle.goto(x + 2*humanizeFactor * (Math.random() - 0.5) , y + 2*humanizeFactor * (Math.random() - 0.5) );
    turtle.pendown();
    
    turtle.setheading(0 * humanizeFactor * (Math.random() - 0.5));
    
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5) );
    
    turtle.left(45 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(14.1 + humanizeFactor * (Math.random() - 0.5)); //100 * (2 ^ (1/2))
    
    turtle.right(135 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.left(90 + humanizeFactor * (Math.random() - 0.5))
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(135 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(14.1 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.left(45 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(45 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(14.1 * 2 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(135 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(45 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(14.1 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.left(135 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(90 + humanizeFactor * (Math.random() - 0.5))
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.left(135 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(14.1 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(45 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(10 + humanizeFactor * (Math.random() - 0.5));
    
    turtle.right(135 + humanizeFactor * (Math.random() - 0.5));
    turtle.forward(14.1 * 2 + humanizeFactor * (Math.random() - 0.5));
}

function fillTooth(x, y){ 
    var humanizeFactor = 1;
       turtle.setheading(135 + 1.0 * humanizeFactor * (Math.random() - 0.5));
       
       
       
        for(var i = 0; i < 20; i++){
            turtle.penup();
            turtle.goto(x + i*0.5 + humanizeFactor * (Math.random() - 0.5), y + humanizeFactor * (Math.random() - 0.5));
            turtle.pendown();
            turtle.forward(14.1 * 2 + humanizeFactor * (Math.random() - 0.5)); 
 
            turtle.penup();
            turtle.goto(x + 20 + i*0.5+ humanizeFactor * (Math.random() - 0.5), y + humanizeFactor * (Math.random() - 0.5));
            turtle.pendown();
            turtle.forward(14.1 * 2 + humanizeFactor * (Math.random() - 0.5)); 
        
            turtle.penup();
            turtle.goto(x + 20+ humanizeFactor * (Math.random() - 0.5), y - i*0.5 - 1+ humanizeFactor * (Math.random() - 0.5));
            turtle.pendown();
            turtle.forward(14.1 * 2 + humanizeFactor * (Math.random() - 0.5)); 
        
            turtle.penup();
            turtle.goto(x + 20+ humanizeFactor * (Math.random() - 0.5), y + 20 - i*0.5 - 1+ humanizeFactor * (Math.random() - 0.5));
            turtle.pendown();
            turtle.forward(14.1 * 2 + humanizeFactor * (Math.random() - 0.5)); 
            
        }
}