The evolution of intelligence