From 79973c327eeb9a94aed1c158229cd77321e3c8b9 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Fri, 22 Dec 2023 14:57:21 +0100 Subject: [PATCH] move_agent: Handle single positions that are lists Only the first element is checked, since iterating though all would be slower. --- mesa/space.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesa/space.py b/mesa/space.py index 43d084f3452..5c01fca2fff 100644 --- a/mesa/space.py +++ b/mesa/space.py @@ -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 isinstance(pos[0], (int, float)): pos = self.torus_adj(pos) self.remove_agent(agent) self.place_agent(agent, pos)