Use if(ballsPresent()) to have Karel only pick up a ball if one actually exists on that space.
Instead of writing the same code twice, define a function called buildTower() . Call it once, move Karel to the next location, and call it again. 4.1.1: The For Loop codehs all answers karel top
This is the "Hello World" of Karel. You simply need to move Karel to a specific spot and place a ball. Move twice, put the ball down, and move once more. Use if(ballsPresent()) to have Karel only pick up
Use a "turnRight" function (three turnLefts) if you need to move back down. 2.2.1: The Two Towers This level introduces the concept of code reusability. Use a "turnRight" function (three turnLefts) if you
Use for-loops when you know exactly how many times an action needs to repeat. Logic for Advanced Karel Levels