When the event is next pondered, the brain essentially runs a simulation, reliving the physical feelings of the event. Those feelings then serve to navigate, or at least bias, subsequent decision making. If the feelings from a given event are bad, they dissuade the action; if they are good, they encourage it.

