function start(){ if (facingNorth()) { buildTower(); }else{ turnNorth(); }// This function has karel face north, no matter what direction // karel starts facing. function turnNorth(){ if (facingWest ()) { turnRight(); buildTower(); }else{ if (facingSouth ()){ turnLeft(); turnLeft(); buildTower (); }else{ if (facingEast() ){ turnLeft (); buildTower(); } } } }/ This function builds a tower all the way to the top of the world. function buildTower ( ){ putBall (); while(frontIsClear ()) { move () ; putBall (); } }function turnRight(){ turnLeft(); turnLeft(); turnLeft(); } }
You can do the spacing and indentation