Skip to main content

faceNorth

 This programmakes Karel place down tennis balls up to the top row
function start(){
     faceNorth();
    buildTower();
    putBall();
}

//This function make Karel face north is Karel is facing west.
function faceNorth(){
    if(facingWest()){
           turnRight();
    }
    if(facingEast()){
          turnLeft();
    }
   
    if(facingSouth()){
        turnLeft();
        turnLeft();
    }
}
//This function makes Karel put the tennis balls up to the top of the "world".

function buildTower(){
    while(frontIsClear()){
         putBall();
        move();
    }
}