Even with their yelling and fainting competing for your attention, it’s hard not to notice a goat’s eyes. Their horizontal, rectangular pupils seem alien compared to the round pupils of people and dogs and the vertical slits of cats. Why do goats’ eyes look like that? And for that matter, why do cats’ eyes look the way they do? In a new study, vision scientist Martin Banks has found that the shape of an animal’s pupils is a clue to its place in the food chain.

Banks and his team looked at the eyes of 214 different species of land animals, and found a clear relationship between the shape of their pupils and their ecological role. Predatory animals that ambush their prey tend to have vertical slit pupils, while herbivores that are prey for other animals usually have horizontal pupils.

The predator-prey divide in pupil shape suggests that the hunters and the hunted gain some advantage from having a specific type of pupil. To find out what those advantages might be, the researchers analyzed the abilities of the two pupil shapes and how they could serve the different visual requirements of predators and prey.

Goats and other grazing animals (like deer, cattle and moose) that are hunted by predators have a pretty simple strategy for not being eaten: look out for danger and run away if they see it. Their eyes need to be able to do two things to support that strategy. “On the one hand, these animals must see panoramically to detect predators that could approach from various directions,” the researchers write. “On the other hand, they must see sufficiently clearly in the forward direction to guide rapid locomotion over potentially rough terrain.”

Horizontal pupils help here, the team found, because their shape creates a sharp panoramic view that’s wider and shorter than what you’d get with a round or vertical pupil and lets the animal see nearly all around itself. A long horizontal pupil also enhances the image quality of objects ahead of and behind the animal, and helps the eye capture more light along the ground and less dazzling overhead light.

Of course, those benefits don’t apply if the pupil stays oriented the same way and becomes vertically aligned when the animal tilts its head to graze. After watching grazing animals at the zoo, though, the researchers found that their eyes rotate to stay horizontally aligned with the ground whether their heads are upright or face down in the grass.

For a land animal that’s in danger of being eaten by something else and has few options besides being aware of its surroundings and running away, the researchers say that a long horizontal pupil seems to be ideal. In other words, goats have weird eyes because they help keep goats alive.

Meanwhile, the team found that vertical, slit-shaped pupils help small ambush predators like cats and snakes judge the distance of prey and other objects so they know how far they have to pounce.