diff --git a/domain/world.py b/domain/world.py index 7f51a9d..f31d84e 100644 --- a/domain/world.py +++ b/domain/world.py @@ -1,3 +1,4 @@ +from decisionTree.evaluate import evaluate from domain.entities.entity import Entity @@ -16,6 +17,8 @@ class World: def add_entity(self, entity: Entity): if entity.type == "PEEL": self.dust[entity.x][entity.y].append(entity) + elif entity.type == "EARRING": + self.dust[entity.x][entity.y].append(entity) elif entity.type == "VACUUM": self.vacuum = entity elif entity.type == "DOC_STATION": @@ -30,7 +33,10 @@ class World: return bool(self.obstacles[x][y]) def is_garbage_at(self, x: int, y: int) -> bool: - return bool(self.dust[x][y]) + if len(self.dust[x][y]) == 0: + return False + tmp = evaluate([self.dust[x][y][0].props]) + return bool(tmp[0]) def is_docking_station_at(self, x: int, y: int) -> bool: return bool(self.doc_station.x == x and self.doc_station.y == y)