Karel Fans, We Dare You!

Karel is hunting for the legendary Treasure of the Pharaoh’s. He is almost there – one last deadly trap awaits him! He stands in complete darkness, at the cross-section of four tunnels. He is facing a random direction – either North, West, South or East. He knows that the West tunnel leads to the treasure while the remaining three contain a metal-eating bacteria that would destroy him. Using the map of the pyramid that you can see, write a program for Karel to collect all gems and enter his home square! Can you do it using just 11 lines of code? More problems like this can be found in the Karel textbook starting with page 75. All problems can be downloaded from NClab’s public database – search for the keywords “textbook karel”.