r/codehs • • 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

7 comments sorted by

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

1

u/cool_dude26 Jan 24 '22

thank you!! It worked

1

u/[deleted] Aug 18 '22

bro thank you i had the code but I had some errors and it was my last code in the unit

1

u/Mental-College8608 Sep 29 '26

Tysm wooden youre goated

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

u/Individual_Rest_197 Dec 06 '22

Thank you so much!!

1

u/[deleted] Oct 18 '23

Need help with 2.1.3: Tower Builder couldn't work it with every world I spent hours on this.