Welcome to our new site!
If you shopped with us on our previous site please reset your password here.
Welcome to our new site!
If you shopped with us on our previous site please reset your password here.
Karel needs to build towers of tennis balls at specific intervals. This teaches you how to break a large problem down into smaller functions (decomposition).
To advance past basic levels, you must master these structural elements: Top Down Design | CodeHS Tutorial| Karel Programming codehs all answers karel top
function main() buildTower(); moveToNextTower(); buildTower(); Karel needs to build towers of tennis balls
Break this problem into reusable functions. Create a buildTower() function and a comeDown() function. Call them sequentially at the first location, move Karel to the second location, and call the exact same functions again. Advanced Karel: Conditional Checksheets Create a buildTower() function and a comeDown() function
If your browser crashes or CodeHS says your code is taking too long, you wrote an infinite loop. This usually happens when you write while(frontIsClear()) putBall(); without including a move(); command inside the brackets. Karel stands still forever because the front remains clear!
Notice anything missing? Karel cannot turn right, and Karel cannot walk backward. To succeed in advanced levels, you have to build these capabilities from scratch using functions. 🛠️ Building the Essential Toolkit (The Top Functions)
The Goal: Karel must move a pile of tennis balls from the current corner to the next corner.