Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

solution #336

wants to merge 2 commits into from

Conversation

Depaton
Copy link

@Depaton Depaton commented Oct 29, 2023

No description provided.

Copy link

@Dimosphen1 Dimosphen1 left a 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

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
Comment on lines 45 to 53
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

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:

Suggested change
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:

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:

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

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:

Suggested change
is_drowned: bool = False
is_drowned: bool | None = False

@Depaton Depaton requested a review from Dimosphen1 October 30, 2023 21:47
Copy link

@viktoria-rybenchuk viktoria-rybenchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants