Follow the Trail Home
Hard · Variables
Karel stands on the first ball of a trail, facing the second one. The trail is a line of single balls that turns left and right. Pick up every ball of the trail, then go back to the square where you started and put all the balls there in one pile.
The trail never touches itself, so the next ball is always straight ahead, to the left or to the right. Your code runs in several worlds.
Hint: keep track of how far east and north you are from the start with two variables. facingEast() and friends tell you which way a step goes.
Next: Paint a Strange Room