From 626f29f7fdcf22f8c2093db7aee186442acf067f Mon Sep 17 00:00:00 2001 From: kulisak12 Date: Sun, 18 Sep 2022 11:49:16 +0200 Subject: [PATCH] =?UTF-8?q?Strategick=C3=A1:=20Fix=20chybek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- klient/play.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/klient/play.py b/klient/play.py index 97246e2..4b12aba 100755 --- a/klient/play.py +++ b/klient/play.py @@ -37,8 +37,8 @@ state: State class Member: - def __init__(self, field: Field, team: int, id: int): - self.field = field, + def __init__(self, field: Field, team: int, id: int) -> None: + self.field = field self.team = team self.id = id self.action = Action.STAY @@ -49,7 +49,7 @@ class Field: def __init__(self, i: int, j: int, hill: bool, home_for_team: Optional[int], - occupied_by_team: Optional[int]): + occupied_by_team: Optional[int]) -> None: self.i = i self.j = j self.hill = hill @@ -79,7 +79,7 @@ class Field: neighbour_i = self.i neighbour_j = self.j # ensure coords are in bounds - neighbour_i %= len(state.world), + neighbour_i %= len(state.world) neighbour_j %= len(state.world[0]) return state.world[neighbour_i][neighbour_j] @@ -147,10 +147,10 @@ def pathfind(member: Member, goal: Field) -> Action: if (neighbour in explored or not neighbour.is_accessible(member.team)): continue - if field == member.field: + if neighbour == member.field: return action.invert() queue.append(neighbour) - explored.add(field) + explored.add(neighbour) return Action.STAY