Browse Source

Strategická: Fix chybek

master
David Klement 2 years ago
parent
commit
626f29f7fd
  1. 12
      klient/play.py

12
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

Loading…
Cancel
Save