-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Solution' #309
base: master
Are you sure you want to change the base?
'Solution' #309
Conversation
app/main.py
Outdated
self.is_drowned = is_drowned | ||
self.decks = Ship.create_decks(start, end) | ||
|
||
def get_deck(self, row: int, column: int) -> Deck: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can also return None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not fixed
app/main.py
Outdated
self.is_drowned = True | ||
for deck in self.decks: | ||
if deck.is_alive: | ||
self.is_drowned = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use any/all
app/main.py
Outdated
if ship_begin == ship_end: | ||
return [Deck(*ship_begin)] | ||
|
||
def fire(self, row, column): | ||
# Change the `is_alive` status of the deck | ||
# And update the `is_drowned` value if it's needed | ||
pass | ||
border = 0 | ||
if ship_begin[1] != ship_end[1]: | ||
border = 1 | ||
|
||
ship_decks = [Deck(ship_begin[0], ship_begin[1])] | ||
blank_deck = [ship_begin[0], ship_begin[1]] | ||
|
||
while blank_deck[border] != ship_end[border]: | ||
blank_deck[border] += 1 | ||
ship_decks.append(Deck(blank_deck[0], blank_deck[1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of if+ while just use forloop into forloop
app/main.py
Outdated
else: | ||
return "Miss!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else: | |
return "Miss!" | |
return "Miss!" |
app/main.py
Outdated
self.is_drowned = is_drowned | ||
self.decks = Ship.create_decks(start, end) | ||
|
||
def get_deck(self, row: int, column: int) -> Deck: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not fixed
app/main.py
Outdated
if ship_begin == ship_end: | ||
return [Deck(*ship_begin)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is redundant
No description provided.