From 9baef6bac80039978f0cad47a9c4662217f4e7cd Mon Sep 17 00:00:00 2001 From: ShreyasN Date: Fri, 5 Dec 2025 22:54:19 +0530 Subject: [PATCH] =?UTF-8?q?Fix=20NoneType=20position=20error=20in=20Hotell?= =?UTF-8?q?ing=E2=80=99s=20Law=20SpaceDrawer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/hotelling_law/app.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/hotelling_law/app.py b/examples/hotelling_law/app.py index ec195ede..2d84e563 100644 --- a/examples/hotelling_law/app.py +++ b/examples/hotelling_law/app.py @@ -127,6 +127,8 @@ def SpaceDrawer(model): # Track store agents for cell coloring if isinstance(agent, StoreAgent): + if agent.pos is None: + continue if agent.pos not in cell_store_contents: cell_store_contents[agent.pos] = [] cell_store_contents[agent.pos].append(portrayal) @@ -152,6 +154,8 @@ def SpaceDrawer(model): # Jittered scatter plot for all agents for agent in model.agents: + if agent.pos is None: + continue portrayal = agent_portrayal(agent) jitter_x = np.random.uniform(-jitter_amount, jitter_amount) + agent.pos[0] + 0.5 jitter_y = np.random.uniform(-jitter_amount, jitter_amount) + agent.pos[1] + 0.5