Skip to content

Solution#660

Open
ThallesG04 wants to merge 2 commits intomate-academy:masterfrom
ThallesG04:develop
Open

Solution#660
ThallesG04 wants to merge 2 commits intomate-academy:masterfrom
ThallesG04:develop

Conversation

@ThallesG04
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Great work on this task! Your solution correctly implements the core requirements, and the class structure for Battleship, Ship, and Deck is well-organized. The fire method behaves exactly as expected.

I am approving your submission. For future improvements, here are a couple of minor points to consider:

  • In app/main.py, there is a typo in the _validade_coord method name. It should be _validate_coord for correctness.
  • The is_drowned parameter in the Ship class constructor is redundant. A ship always starts with all decks intact, so you can remove this parameter and set self.is_drowned = False directly within the __init__ method.

These are just suggestions for refinement and don't affect the functionality. Keep up the excellent work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

def __init__(self,
start: Coord,
end: Coord,
is_drowned: bool = False

Choose a reason for hiding this comment

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

The is_drowned parameter is unnecessary here. A ship should never be in a 'drowned' state when it's first created, as all its decks are initialized as 'alive'. It's better to set self.is_drowned = False directly within the __init__ method to prevent creating objects with an inconsistent state.

raise ValueError("Overlapping ships detected.")
self.field[deck.coord] = ship

def _validade_coord(self, coord: Coord) -> None:

Choose a reason for hiding this comment

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

There's a typo in the method name. It should be _validate_coord. Remember to correct the calls to this method on lines 82 and 100 as well.

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.

2 participants