From 10c3ec7e42db7d6a08fa5b5da6b943af09c3c4a1 Mon Sep 17 00:00:00 2001 From: Sergio Tessaris <tessaris@inf.unibz.it> Date: Wed, 9 Mar 2022 11:02:24 +0100 Subject: [PATCH] doc: more class documentation --- wumpus/gridworld.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wumpus/gridworld.py b/wumpus/gridworld.py index 6dcd387..b6a240a 100644 --- a/wumpus/gridworld.py +++ b/wumpus/gridworld.py @@ -410,12 +410,15 @@ class GridWorld(object): class Food(WorldObject): + """Food in the EaterWorld, it can be consumed by the Eater agent.""" def charSymbol(self): return 'ðŸŒ' class Eater(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.""" class Actions(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): class EaterWorld(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. + """ @classmethod def random(cls, map_desc: str=None, size: Coordinate=None, blocks: Iterable[Coordinate]=[], food_amount: float=.1, **kwargs) -> 'EaterWorld': """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. -- GitLab