Modeling emotion dynamics in intelligent agents