"""Food in the EaterWorld, it can be consumed by the Eater agent."""
defcharSymbol(self):
return'🍌'
classEater(Agent):
"""An agent that moves in the EaterWorld. It can move in 4 directions (Eater.Actions) and consumes Food objects that are in the cells where it moves. It sees its position and smells whether there's still food in the world (Eater.Percept). Its goal is to consume all the food in the environment."""
classActions(Actions):
"""Eater actions for each direction in which the agent can move (N, S, E, W)"""
N=(0,1)
S=(0,-1)
E=(1,0)
...
...
@@ -484,6 +487,8 @@ class Eater(Agent):
classEaterWorld(GridWorld):
"""A GridWorld which contains Food and a Eater agent that can move within the world and eat the food when it moves in a cell that contains some food.
"""Create a new world from the map description and randomly place food until the given percentage of the free space is filled. If the food amount is greater or equal than 1 then it's interpreted as the number of food objects to include.