A Bayesian theory of mind approach to modeling cooperation and communication