Browse Source

Strategická: Načti protected_for_team

master
David Klement 2 years ago
parent
commit
67cd40a3f0
  1. 8
      klient/play.py

8
klient/play.py

@ -54,12 +54,14 @@ class Field:
def __init__(self, i: int, j: int, hill: bool,
home_for_team: Optional[int],
occupied_by_team: Optional[int]) -> None:
occupied_by_team: Optional[int],
protected_for_team: Optional[int],) -> None:
self.i = i
self.j = j
self.hill = hill
self.home_for_team = home_for_team
self.occupied_by_team = occupied_by_team
self.protected_for_team = protected_for_team
def __eq__(self, other: Field) -> bool:
return (self.i, self.j) == (other.i, other.j)
@ -93,7 +95,8 @@ class Field:
if self.hill:
return False
if self.home_for_team is not None and self.home_for_team != team:
if (self.protected_for_team is not None and
self.protected_for_team != team):
return False
return True
@ -178,6 +181,7 @@ def parse_world(world: dict) -> List[List[Field]]:
field["hill"],
field["home_for_team"],
field["occupied_by_team"],
field["protected_for_team"],
)
members = []
for member in field["members"]:

Loading…
Cancel
Save