@brib In general, and on a species level, animals tend to be as smart as they need to be. Brain matter is a terribly expensive energy sink.
I poked a lot of fun at the comically small-brained stegosaurs yesterday, but they were obviously smart enough to get by. They just walked around hoovering up ferns and cycads, and occasionally bashed an allosaur's face in with the thagomizer. They were around for about 10 million years, which is a pretty respectable evolutionary tenure.
A question I've sometimes been asked is why elephants are so smart when stegosaurs were so dumb. They have a lot of superficial similarities: They're slow-moving herbivores who mainly protect themselves by being enormous and having access to some scary pointy implements. But elephants have trunks they can use to manipulate objects, and that tends to select for co-evolving a sophisticated brain - and also, elephants are highly social, and need to be able to understand rather complex social dynamics. Also, a modern-day African savannah is a much more complex and dangerous place than a Jurassic floodplain: A stegosaur never had to face a cooperating pride of lions or a gang of cunning hyenas (both of which absolutely will attack vulnerable elephants). Elephants have to deal with water scarcity, and their energy requirements are estimated to be around three times higher than a stegosaur's.
An elephant is a lot smarter than a stegosaur *because it has to be*.
(Both elephants and stegosaurs encountered crocodiles, though. How's that for evolutionary tenure?)