mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-05 09:01:36 +02:00
environment code changes for RL settings
This commit is contained in:
@ -188,7 +188,9 @@ class SpawnAgents(Rule):
|
||||
positions = agent_conf['positions'].copy()
|
||||
other = agent_conf['other'].copy()
|
||||
|
||||
if position := h.get_first(x for x in positions if x in empty_positions):
|
||||
# Spawn agent on random position if multiple spawn points are provided
|
||||
func = random.choice if len(positions) else h.get_first
|
||||
if position := func([x for x in positions if x in empty_positions]):
|
||||
assert state.check_pos_validity(position), 'smth went wrong....'
|
||||
agents.add_item(Agent(actions, observations, position, str_ident=agent_name, **other))
|
||||
elif positions:
|
||||
|
Reference in New Issue
Block a user