Many returns

Here is a sample program illustrating what could come next.

As we mentioned at the very beginning, Reeborg has a broken compass. As a result, he only knows directly if he is facing North, or if he isn't. However, now that we know that Reeborg can remember things, we can teach him to find out which direction he is facing. For example:

def facing_South():
    turn_left()
    turn_left()
    answer = facing_North()
    turn_left()
    turn_left()
    return answer
home
../images/SourceForge.net Logo