Earthworms don’t have eyes, but they do have light-sensitive cells in their skin that detect changes in brightness. Coming up to the surface during the day leaves a worm vulnerable to an attack by a bird, so they need to be able to see when it’s safe to emerge.
Round worms can use the salinity of the environment to decide which direction to travel. As salt concentration increases, the worm knows it’s headed towards a food source, and it follows the salt gradient until it finds its meal.
Round worms have a dense ring of nerves that serves as a brain, and each side of this ring reacts to changes in the environment to help keep the worm on track. The left side responds as salt concentration increases, keeping the worm on its current trail, and when right side responds to decreased salt concentration, and the worm alters its course.
Image from www.flickr.com/photos/stuutje