-
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 #469
base: master
Are you sure you want to change the base?
Solution #469
Conversation
app/main.py
Outdated
for index in self.decks: | ||
if index.column == column and index.row == row: | ||
return index | ||
return |
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.
return
- redundant here
app/main.py
Outdated
self.ships = ships | ||
self.field = {} | ||
|
||
for index in range(len(ships)): |
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.
for index in range(len(ships)): | |
for start, end in ships: |
app/main.py
Outdated
keys = [(key.row, key.column) for key in self.field.keys()] | ||
if location not in keys: | ||
return "Miss!" | ||
for index, value in self.field.items(): | ||
if location[0] == index.row and location[1] == index.column: | ||
value.fire(index.row, index.column) | ||
if value.is_drowned is True: | ||
return "Sunk!" | ||
return "Hit!" |
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.
try optimizing this without using a loop
No description provided.