-
Notifications
You must be signed in to change notification settings - Fork 598
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
base: master
Are you sure you want to change the base?
Resolve #476
Conversation
app/main.py
Outdated
@@ -1,34 +1,69 @@ | |||
from __future__ import annotations |
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.
why do you need this? Seems like you use ordinary types in annotation
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, 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
ship_instance = Ship(ship[0], ship[1]) | ||
for deck in Ship(ship[0], ship[1]).decks: |
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 can use unpacking here
- In the loop use ship_instance variable
app/main.py
Outdated
# in the ship or not. | ||
pass | ||
|
||
def __init__(self, ships: list) -> 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.
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: |
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.
specify what data this tuple contains
app/main.py
Outdated
return "Sunk!" | ||
else: | ||
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.
No need for else because if statement exactly returns something as there is another else statement
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.
Good job 👏
No description provided.