How does it work?

The bottom line always has the maximum "heat" value. Heat values are moved up and randomly a bit left and right. When moved there is a chance that the value will decrease a little bit. Heat values of 0 always move straight up.