From 962c56394f285573d6bd7ae8ba66689e5e5b1500 Mon Sep 17 00:00:00 2001 From: charwick <1117120+charwick@users.noreply.github.com> Date: Thu, 4 Jul 2024 01:11:32 -0400 Subject: [PATCH] Fix spatial bug when corner connections but no wrapping --- helipad/__init__.py | 2 +- helipad/spatial.py | 4 +++- meta.yaml | 4 ++-- pyproject.toml | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/helipad/__init__.py b/helipad/__init__.py index a1ff280..3e925d8 100644 --- a/helipad/__init__.py +++ b/helipad/__init__.py @@ -6,4 +6,4 @@ from helipad.agent import Agent, baseAgent from helipad import utility -__version__ = "1.6.1" \ No newline at end of file +__version__ = "1.6.2" \ No newline at end of file diff --git a/helipad/spatial.py b/helipad/spatial.py index 3447b0e..73bb35c 100644 --- a/helipad/spatial.py +++ b/helipad/spatial.py @@ -162,7 +162,9 @@ def at(self, x, y): return self[round(x), round(y)] def neighbors(self, model): for patch in model.agents['patch']: neighbors = [(patch.right, 1), (patch.down, 1)] - if self.corners: neighbors += [(patch.down.right, self.corners), (patch.left.down, self.corners)] + if self.corners: + if patch.down and patch.down.right: neighbors.append((patch.down.right, self.corners)) + if patch.left and patch.left.down: neighbors.append((patch.left.down, self.corners)) for n, weight in neighbors: if n: patch.edges.add(n, 'space', weight=weight) diff --git a/meta.yaml b/meta.yaml index 70f64ad..f761955 100644 --- a/meta.yaml +++ b/meta.yaml @@ -1,5 +1,5 @@ {% set name = "helipad" %} -{% set version = "1.6.1" %} +{% set version = "1.6.2" %} package: name: {{ name|lower }} @@ -7,7 +7,7 @@ package: source: url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/helipad-{{ version }}.tar.gz - sha256: b3baa09f1891a08dd4e47ebf414f62f7612a7b8c139eb0b9b2ce2c801b013f71 + sha256: 5b5801daa7fbe8d435dc96504b65eed5670a21709845b113e17453877b366242 build: noarch: python diff --git a/pyproject.toml b/pyproject.toml index 4c2d3cb..d1233ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "helipad" -version = "1.6.1" +version = "1.6.2" authors = [ { name="C Harwick", email="cameron@cameronharwick.com" }, ]