Thermodynamic codes