The paper, published last week in the journal Proceedings of the National Academy of Sciences, is accompanied online by videos showing the animals doing what looks for all the world like the shell game in which a player has to guess where the pea is.

But in this shell game, the animals have been trained to find the food under the same container each time. Then, for the test, the researcher moves the food, but clearly shows the animal where it ends up.

To make the right decision, the animal has to override a habit, ingrained by training, and reach for the spot where it has seen the food placed. This involves so-called “inhibitory control,” Dr. MacLean said. Animals that succeed are able to act on the evidence in front of them, not just follow the dictates of habit.

The other test is almost the reverse. Animals are taught to look inside an opaque cylinder in which the researcher has placed food. Then a transparent cylinder is introduced and the animal can see the food. There’s powerful temptation to reach directly for it, even though the cylinder blocks that access. In this case the animal has to remember its training to solve the problem.

Why absolute brain volume and variety of diet are most important for these tests remains to be understood. The hope, Dr. MacLean said, is that more comparative studies like this will lead to a better understanding of how self-control and other cognitive skills evolve.