Untitled
unknown
plain_text
4 years ago
867 B
72
Indexable
//This Program Has Karel make three ball height towers infinitely
function start() {
buildTower1();
descendTower();
loopTowers();
}
//This makes loop of building towers
function loopTowers(){
while(noBallsPresent()){
if(frontIsClear()){
move();
buildTower1();
descendTower();
}
}
}
//Karel Builds Tower of Three Balls
function buildTower1(){
putBall();
turnLeft();
move();
putBall();
move();
putBall();
}
//This Makes Karel Go Down To Street One
function descendTower(){
if(rightIsClear()){
turnRight();
move();
turnRight();
move();
move();
turnLeft();
}else{
turnAround();
move();
move();
turnLeft();
}
}
Editor is loading...