From 0e8e42f2f3c43a3c3737d2fb1a11ea0391b67ec0 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 --- mesa/space.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mesa/space.py b/mesa/space.py index 43d084f3452..c06014e29e2 100644 --- a/mesa/space.py +++ b/mesa/space.py @@ -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)