mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-05-23 07:16:44 +02:00
Small adjustment and a not was missing rules
This commit is contained in:
parent
9420986230
commit
85d65a2c78
@ -70,7 +70,7 @@ class Entity(EnvObject, abc.ABC):
|
|||||||
try:
|
try:
|
||||||
self.bind_to(bind_to)
|
self.bind_to(bind_to)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
print(f'Objects of {self.__class__.__name__} can not be bound to other entities.')
|
print(f'Objects of class "{self.__class__.__name__}" can not be bound to other entities.')
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
def summarize_state(self) -> dict: # tile=str(self.tile.name)
|
def summarize_state(self) -> dict: # tile=str(self.tile.name)
|
||||||
|
@ -41,7 +41,7 @@ class Entities(Objects):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def empty_positions(self):
|
def empty_positions(self):
|
||||||
empty_positions= [key for key in self.floorlist if self.pos_dict[key]]
|
empty_positions = [key for key in self.floorlist if not self.pos_dict[key]]
|
||||||
shuffle(empty_positions)
|
shuffle(empty_positions)
|
||||||
return empty_positions
|
return empty_positions
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ class Btry(Rule):
|
|||||||
self.initial_charge = initial_charge
|
self.initial_charge = initial_charge
|
||||||
|
|
||||||
def on_init(self, state, lvl_map):
|
def on_init(self, state, lvl_map):
|
||||||
|
assert len(state[c.AGENT]), "There are no agents, did you already spawn them?"
|
||||||
state[b.BATTERIES].spawn(state[c.AGENT], self.initial_charge)
|
state[b.BATTERIES].spawn(state[c.AGENT], self.initial_charge)
|
||||||
|
|
||||||
def tick_pre_step(self, state) -> List[TickResult]:
|
def tick_pre_step(self, state) -> List[TickResult]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user