mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-06-18 18:52:52 +02:00
Refactoring of movement logic and parallel collision checks
This commit is contained in:
@ -64,16 +64,7 @@ def check_agent_move(state, dim, action):
|
||||
or y_new >= agent_slice.shape[0]
|
||||
)
|
||||
|
||||
if valid:
|
||||
collisions_vec = state[:, x_new, y_new].copy() # "vertical fiber" at position of agent i
|
||||
collisions_vec[dim] = IS_FREE_CELL # no self-collisions
|
||||
pass
|
||||
else:
|
||||
collisions_vec = state[:, x, y].copy() # "vertical fiber" at position of agent i
|
||||
collisions_vec[dim] = IS_FREE_CELL # no self-collisions
|
||||
collisions_vec[LEVEL_IDX] = IS_OCCUPIED_CELL
|
||||
did_collide = collisions_vec.sum(0) != IS_FREE_CELL
|
||||
return (x, y), (x_new, y_new), collisions_vec, did_collide
|
||||
return (x, y), (x_new, y_new), valid
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Reference in New Issue
Block a user