added function for chapter 4
added function for chapter 4

agentmodels/webppl-agents,agentmodels/webppl-gridworld,jsalvatier/webppl-agents,agentmodels/webppl-gridworld,agentmodels/webppl-gridworld,jsalvatier/webppl-agents,jsalvatier/webppl-agents