From 1df00939ef5e534879124cfd3ca0cf2f865a69a9 Mon Sep 17 00:00:00 2001 From: jinjo Date: Tue, 10 Oct 2023 09:10:53 +0200 Subject: [PATCH] Solution --- app/main.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/main.py b/app/main.py index a81f8d77..d726502f 100644 --- a/app/main.py +++ b/app/main.py @@ -1,4 +1,4 @@ -from typing import Tuple, List +from typing import Tuple, List, Union class Deck: @@ -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 @@ -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):