Sort:  

It was programmed to have a happy ending.