GridWorld.add_object#

GridWorld.add_object(coord, reward, prob, punish=0)[source]#

Add one object to the world.

Each state can only have one object.

Parameters:
  • coord (tuple of ints) – Coordinate of the state to place the object.

  • reward (int or float) – Reward that the object can generate.

  • prob (float) – Probability for the object to generate a reward.

  • punish (int or float (optional, default: 0)) – Punishment that the object will generate if failed to generate a reward.

Examples

>>> W = GridWorld()
>>> W.add_area((2, 2))
>>> W.add_object((0, 0, 0), reward=1, prob=0.7)
>>> W.add_object((1, 0, 0), reward=1, prob=0.3, punish=-10)