How can I simulate temperature in the BGE?

How would someone write a script that simulates temperature? Water melts/freezes at 0C, so how would someone simulate temperature in a python script for the BGE, along with a game property?

Partially related:

Note that the shader in the link above is a screen shader and not a OOP shader like you are looking for to work with game-properties.

That would depend on what you want to do with temperature. Do you just want to have a temperature property, what will that property affect, how do you want temperature to change, etc.

For example, you can make a “TemperatureControl” object that records and tracks the temperature for the whole scene with a property, then have ice cubes check that object to get the temperature.

oh wait did you mean how to simulate ice melting/freezing