Skip to content

Commit

Permalink
move_agent: Handle single positions that are lists
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutH committed Dec 22, 2023
1 parent ed498d8 commit b2f4406
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def move_agent(
cells are the same distance, one is chosen randomly.
"""
# Handle single position case quickly
if isinstance(pos, tuple):
if isinstance(pos, (tuple, list)) and all(isinstance(p, (int, float)) for p in pos):
pos = self.torus_adj(pos)
self.remove_agent(agent)
self.place_agent(agent, pos)
Expand Down

0 comments on commit b2f4406

Please sign in to comment.