def displayDistributionsOverPositions(self, distributions):
"""
Overlays a distribution over positions onto the pacman board that represents
an agent's beliefs about the positions of each agent.
The arg distributions is a tuple or list of util.Counter objects, where the i'th
Counter has keys that are board positions (x,y) and values that encode the probability
that agent i is at (x,y).
If some elements are None, then they will be ignored. If a Counter is passed to this
function, it will be displayed. This is helpful for figuring out if your agent is doing
inference correctly, and does not affect gameplay.
"""
dists = []
for dist in distributions:
if dist != None:
if not isinstance(dist, util.Counter): raise Exception("Wrong type of distribution")
dists.append(dist)
else:
dists.append(util.Counter())
if self.display != None and 'updateDistributions' in dir(self.display):
self.display.updateDistributions(dists)
else:
self._distributions = dists # These can be read by pacclient.py
评论列表
文章目录