Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
493 B
10
Indexable
Never
function start(){
    buildTower();
    turnRight();
    checkWall();
}
//this function makes karel to build a tower
function buildTower(){
       putBall();
       turnLeft();
       move();
       putBall();
       move();
       putBall();
}

function checkWall(){
    if (frontIsClear()){
        move();
        turnRight();
        move();
        move();
        turnLeft();
    } else (frontIsBlocked()){
        turnRight();
        move();
        move();
        turnLeft();
    }
}