The Thermodynamics of Intelligence