-
Notifications
You must be signed in to change notification settings - Fork 605
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 #336
base: master
Are you sure you want to change the base?
solution #336
Conversation
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.
Several changes were requested.
|
||
def get_deck(self, row, column): | ||
def get_deck(self, row: int, column: int) -> Deck: | ||
# Find the corresponding deck in the list |
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.
Remove all comments from your PR.
app/main.py
Outdated
cheker = False | ||
for decks in self.decks: | ||
if decks.is_alive is True: | ||
cheker = True | ||
break | ||
if cheker is True: | ||
self.is_drowned = False | ||
else: | ||
self.is_drowned = True |
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.
You could rewrite this code in one line:
cheker = False | |
for decks in self.decks: | |
if decks.is_alive is True: | |
cheker = True | |
break | |
if cheker is True: | |
self.is_drowned = False | |
else: | |
self.is_drowned = True | |
self.is_drowned = not any(deck.is_alive for deck in self.decks) |
app/main.py
Outdated
self.field[location].fire(location[0], location[1]) | ||
if not self.field[location].is_drowned: | ||
return "Hit!" | ||
else: |
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.
Remove else
as mentioned in the checklist.
app/main.py
Outdated
@@ -1,34 +1,76 @@ | |||
class Deck: | |||
def __init__(self, row, column, is_alive=True): | |||
pass | |||
def __init__(self, row: int, column: int, is_alive: bool = True) -> 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.
Place all arguments on a new line for better code perception.
app/main.py
Outdated
self, | ||
start: tuple, | ||
end: tuple, | ||
is_drowned: bool = 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.
You could annotate optional arguments:
is_drowned: bool = False | |
is_drowned: bool | None = 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.
Well done!
No description provided.