What does the mystery function do?
function mystery() {
while (noBallsPresent()) {
move();
}
}
JavaScript
Karel moves until it is on a ball
Karel moves once if there is no ball present
Karel moves until it puts down a ball
Karel checks if there is no ball on the current spot and then moves once