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

Resolve #476

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

Resolve #476

wants to merge 2 commits into from

Conversation

ihorutkin
Copy link

No description provided.

app/main.py Outdated
@@ -1,34 +1,69 @@
from __future__ import annotations
Copy link

Choose a reason for hiding this comment

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

why do you need this? Seems like you use ordinary types in annotation

Copy link
Author

Choose a reason for hiding this comment

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

Not, get_deck function returns Deck object, but it only one place where I using it, so would it be right if I deleted this and just wrote “Deck”, it also works

app/main.py Outdated
Comment on lines 55 to 56
ship_instance = Ship(ship[0], ship[1])
for deck in Ship(ship[0], ship[1]).decks:
Copy link

Choose a reason for hiding this comment

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

  1. You can use unpacking here
  2. In the loop use ship_instance variable

app/main.py Outdated
# in the ship or not.
pass

def __init__(self, ships: list) -> None:
Copy link

Choose a reason for hiding this comment

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

specify what data this list contains

app/main.py Outdated
for deck in Ship(ship[0], ship[1]).decks:
self.field[(deck.row, deck.column)] = ship_instance

def fire(self, location: tuple) -> str:
Copy link

Choose a reason for hiding this comment

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

specify what data this tuple contains

app/main.py Outdated
return "Sunk!"
else:
return "Hit!"
else:
Copy link

Choose a reason for hiding this comment

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

No need for else because if statement exactly returns something as there is another else statement

@ihorutkin ihorutkin requested a review from MNDonut September 11, 2024 19:53
Copy link

@LiudmylaKulinchenko LiudmylaKulinchenko left a comment

Choose a reason for hiding this comment

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

Good job 👏

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