Packing stations refactor

This commit is contained in:
Makrellka 2022-06-09 22:24:46 +02:00
parent 3ae78c6ee5
commit d0cde0beab
6 changed files with 13 additions and 6 deletions

View File

@ -102,9 +102,9 @@ class ForkliftAgent(AgentBase):
packing_station: GridLocation = None
stations = dict(self.graph.packingStations)
if i.real_type == ItemType.SHELF:
packing_station = stations[PatchType.packingA]
packing_station = stations[PatchType.packingShelf]
elif i.real_type == ItemType.REFRIGERATOR:
packing_station = stations[PatchType.packingB]
packing_station = stations[PatchType.packingRefrigerator]
elif i.real_type == ItemType.DOOR:
packing_station = stations[PatchType.packingC]

View File

@ -7,7 +7,7 @@ class PatchType(enum.Enum):
item = 3
wall = 4
diffTerrain = 5
packingA = 6
packingB = 7
packingC = 8
packingShelf = 6
packingRefrigerator = 7
packingDoor = 8
divider = 9

BIN
img/door_d.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
img/fridge_f.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
img/shelf_s.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -51,6 +51,13 @@ def agent_portrayal(agent):
portrayal = {"Shape": "img/okB00mer.png", "scale": 1.0, "Layer": 0}
elif agent.patch_type == PatchType.diffTerrain:
portrayal = {"Shape": "img/puddle.png", "scale": 1.0, "Layer": 0}
elif agent.patch_type == PatchType.packingShelf:
portrayal = {"Shape": "img/shelf_s.jpg", "scale": 1.0, "Layer": 0}
elif agent.patch_type == PatchType.packingRefrigerator:
portrayal = {"Shape": "img/fridge_f.jpg", "scale": 1.0, "Layer": 0}
elif agent.patch_type == PatchType.packingDoor:
portrayal = {"Shape": "img/door_d.jpg", "scale": 1.0, "Layer": 0}
elif agent.patch_type == PatchType.divider:
portrayal = \
{"Shape": "rect",
@ -83,7 +90,7 @@ if __name__ == '__main__':
diagram = GridWithWeights(gridWidth, gridHeight)
diagram.walls = [(6, 5), (6, 6), (6, 7), (6, 8), (2, 3), (2, 4), (3, 4), (4, 4), (6, 4)]
diagram.puddles = [(2, 2), (2, 5), (2, 6), (5, 4)]
diagram.packingStations = [(PatchType.packingA, (4, 8)), (PatchType.packingB, (4, 6)), (PatchType.packingC, (4, 2))]
diagram.packingStations = [(PatchType.packingShelf, (4, 8)), (PatchType.packingRefrigerator, (4, 6)), (PatchType.packingDoor, (4, 2))]
grid = CanvasGrid(agent_portrayal, gridWidth, gridHeight, scale * gridWidth, scale * gridHeight)