From 6a11437dd5e4b83fd6a5add7b6ba4a101c91fc41 Mon Sep 17 00:00:00 2001 From: alanwatsonforster <68709385+alanwatsonforster@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:10:43 -0600 Subject: [PATCH] Update checkisvalidposition. --- airpower/aircraft.py | 2 +- airpower/hex.py | 8 ++++---- airpower/hexcode.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/airpower/aircraft.py b/airpower/aircraft.py index 237c7f17..de5807f3 100644 --- a/airpower/aircraft.py +++ b/airpower/aircraft.py @@ -355,7 +355,7 @@ def next(self, actions): break assert self._ifp <= self._nfp - aphex.checkiscenteroredge(self._x, self._y) + aphex.checkisvalidposition(self._x, self._y) aphex.checkisvalidfacing(self._x, self._y, self._facing) apaltitude.checkisvalidaltitude(self._altitude) diff --git a/airpower/hex.py b/airpower/hex.py index dc232e3f..ed37f845 100644 --- a/airpower/hex.py +++ b/airpower/hex.py @@ -30,7 +30,7 @@ def isedge(x, y): else: return False -def iscenteroredge(x, y): +def isvalidposition(x, y): """ Return True if the point (x,y) in hex coordinates corresponds to the center @@ -55,14 +55,14 @@ def areadjacent(x0, y0, x1, y1): else: return False -def checkiscenteroredge(x, y): +def checkisvalidposition(x, y): """ Raise a ValueError exception if the point (x,y) in hex coordinates does not correspond to the center of a hex or to (the center of) the edge of a hex. """ - if not iscenteroredge(x, y): + if not isvalidposition(x, y): raise ValueError("(%s,%s) is not the center or edge of a hex." % (x,y)) def isvalidfacing(x, y, facing): @@ -73,7 +73,7 @@ def isvalidfacing(x, y, facing): center of) the edge of a hex. """ - checkiscenteroredge(x, y) + checkisvalidposition(x, y) if iscenter(x, y): return facing % 30 == 0 diff --git a/airpower/hexcode.py b/airpower/hexcode.py index af42b349..85219def 100644 --- a/airpower/hexcode.py +++ b/airpower/hexcode.py @@ -86,7 +86,7 @@ def fromxy(x, y): Return the hex code corresponding to the hex coordinate (x, y). """ - aphex.checkiscenteroredge(x, y) + aphex.checkisvalidposition(x, y) if aphex.iscenter(x, y):