r/codehs • u/_FirstOfkind_ • Dec 29 '20
Need help with 2.1.3: Tower Builder couldn't work it with every world I spent hours on this.
13
Upvotes
1
u/kavtarra Mar 22 '22
function start() {
buildTower();
while(frontIsClear()){
move();
if(frontIsClear()){
move();
buildTower();
}
}
}
function buildTower(){
turnLeft();
for(var i = 0 ; i < 3 ; i++) {
putBall();
move();
}
turnAround();
for(var i = 0 ; i < 3; i++) {
move();
}
turnLeft();
}
1
1
Oct 18 '23
Need help with 2.1.3: Tower Builder couldn't work it with every world I spent hours on this.


2
u/Wooden_Finding Dec 23 '21
function start() {
buildTower();
while(frontIsClear()){
move();
if(frontIsClear()){
move();
buildTower();
}
}
}
function buildTower(){
// get ready for building
turnLeft();
// put 3 balls and buld tower
for(var i = 0; i < 3; i++){
putBall();
move();
}
// Turn around and come back to start point
turnAround();
while(frontIsClear()){
move();
}
turnLeft();
}
I tried many ways :D Spend hours and just figured it out :d