When a shadow passes over the photosensor on top, it tries to run away. It uses sonic sensors at the front and back to pick an unobstructed direction to run.