Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
jinjo0222988 committed Oct 10, 2023
1 parent 0933528 commit 1df0093
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Tuple, List
from typing import Tuple, List, Union


class Deck:
Expand All @@ -15,7 +15,7 @@ def __init__(self,
self.is_drowned = is_drowned
self.decks = Ship.create_decks(start, end)

def get_deck(self, row: int, column: int) -> Deck:
def get_deck(self, row: int, column: int) -> Union[Deck, None]:
for deck in self.decks:
if deck.coordinate == (row, column):
return deck
Expand All @@ -38,9 +38,6 @@ def get_length(self) -> int:
def create_decks(ship_begin: Tuple[int, int],
ship_end: Tuple[int, int]) -> List:

if ship_begin == ship_end:
return [Deck(*ship_begin)]

ship_decks = []

for row in range(ship_begin[0], ship_end[0] + 1):
Expand Down

0 comments on commit 1df0093

Please sign in to comment.