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 0e8e42f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mesa/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ 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 0e8e42f

Please sign in to comment.