Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
B0hdanR committed Dec 27, 2024
1 parent 234f658 commit 78a74c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def fire(self, row: int, column: int) -> bool:
self.is_drowned = all(not deck.is_alive for deck in self.decks)
return self.is_drowned

def is_alive(self, row: int, column: int) -> bool:
def is_deck_alive(self, row: int, column: int) -> bool:
return any(deck.row == row
and deck.column == column
and deck.is_alive for deck in self.decks)
Expand Down Expand Up @@ -115,8 +115,8 @@ def print_field(self) -> None:
field = [["~"] * 10 for _ in range(10)]
for (row, column), ship in self.field.items():
if ship:
if ship.is_alive(row, column):
field[row][column] = u"\u25A1"
if ship.is_deck_alive(row, column):
field[row][column] = "O"
else:
field[row][column] = "*"
else:
Expand Down

0 comments on commit 78a74c0

Please sign in to comment.