Skip to content

Commit

Permalink
solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey1104 committed Nov 12, 2023
1 parent f1677ed commit 73b48cf
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@


class Deck:
def __init__(self, row: int, column: int, is_alive: bool = True) -> None:
def __init__(
self,
row: int,
column: int,
is_alive: bool = True
) -> None:
self.row = row
self.column = column
self.is_alive = is_alive
Expand Down Expand Up @@ -33,8 +38,7 @@ def fire(self, row: int, column: int) -> str:
if not any(deck.is_alive for deck in self.decks):
self.is_drowned = True
return "Sunk!"
else:
return "Hit!"
return "Hit!"


class Battleship:
Expand Down Expand Up @@ -76,5 +80,4 @@ def fire(self, location: tuple) -> str:
loc_x, loc_y = location
if location in self.field.keys():
return self.field[location].fire(loc_x, loc_y)
else:
return "Miss!"
return "Miss!"

0 comments on commit 73b48cf

Please sign in to comment.