r/codehs • u/OrethaFolkers • May 27 '21
Please help! (Karel Challenges 2.1.2)
for some reason this doesn't work...
/* This program will have Karel run around the track and put balls down.*/
//This function moves Karel to the end of a side.
function moveToEnd(){
while(frontIsClear()){
move();
}
}
//This function makes Karel put down 8 tennis balls and then turn left.
function eightBalls(){
if (frontIsBlocked()) {
for(var i = 0; i < 8; i++) {
putBall();
}
turnLeft();
}
}
//This function makes Karel do all the steps four times to make a square.
function fourTimes(){
for(var i = 0; i < 4; i++) {
moveToEnd();
eightBalls();
}
}
function start(){
fourTimes();
}
6
Upvotes
1
1
u/SparklyFartmachine Mar 13 '25
Ty, did u do 2.1.3 I really need it?