a-star-implementation #22

Merged
s473593 merged 4 commits from a-star-implementation into main 2023-05-14 14:27:45 +02:00
Showing only changes of commit 246fda4e8a - Show all commits

View File

@ -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)