 A common method is to let the flies choose whether they want to fly through a tunnel that leads to a light source, or through a dark tunnel.Normally, flies are attracted to light.But if sugar is placed in the end of the dark tunnel, and something the flies dislike is placed in the end of the light tunnel, the flies will eventually learn to fly towards darkness rather than light.