1
0
mirror of https://github.com/illiumst/marl-factory-grid.git synced 2026-04-24 07:47:32 +02:00

maintainer test

This commit is contained in:
Chanumask
2023-11-16 19:45:25 +01:00
parent f25f90a78b
commit 26318a7b48
4 changed files with 84 additions and 20 deletions
@@ -9,7 +9,6 @@ from marl_factory_grid.environment import constants as c
from marl_factory_grid.modules.destinations import constants as d
from marl_factory_grid.modules.destinations.entitites import Destination
from marl_factory_grid.utils.states import Gamestate
ANY = 'any'
@@ -118,7 +117,7 @@ class SpawnDestinationsPerAgent(Rule):
per_agent_d = {agent_name: [ast.literal_eval(x) for x in value]}
self.per_agent_positions.update(**per_agent_d)
def on_reset(self, state: Gamestate):
def on_reset(self, state):
for (agent_name, coords_or_quantity) in self.per_agent_positions.items():
agent = h.get_first(state[c.AGENT], lambda x: agent_name in x.name)
assert agent
@@ -12,10 +12,11 @@ class MoveMaintainers(Rule):
super().__init__()
def tick_step(self, state) -> List[TickResult]:
move_results = []
for maintainer in state[M.MAINTAINERS]:
maintainer.tick(state)
# Todo: Return a Result Object.
return []
result = maintainer.tick(state)
move_results.append(result)
return move_results
class DoneAtMaintainerCollision(Rule):