Solution to sensor/motor programming exercise