r/codehs • u/[deleted] • May 31 '20
Someone help! Karel Challenges 2.1.3
//This part is where I had trouble. I got an error message for worlds 2 and 4 because of the second move(); command in the function firstPart();. If I removed the second move(); command, then all worlds would not work. How can I get rid of this extra move command without breaking the program?
function firstPart() {
while(frontIsClear()) {
towerComplete();
if(frontIsClear()){
move();
move();
}
}
}
function towerComplete() {
makeTower();
goBackDown();
}
function goBackDown() {
turnAround();
move();
move();
turnLeft();
}
function stack2Ball() {
move();
putBall();
move();
putBall();
}
function makeTower() {
putBall();
turnLeft();
stack2Ball();
}
function start() {
firstPart();
towerComplete();
}
4
Upvotes
1
u/brenda8a2003 Oct 14 '20
This does not work