Poor solution to "toy robot" coding exercise