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

Implement Ship Placement with Overlap and Boundary Checks #41

Open
castilloa25 opened this issue Nov 14, 2024 · 1 comment
Open

Implement Ship Placement with Overlap and Boundary Checks #41

castilloa25 opened this issue Nov 14, 2024 · 1 comment

Comments

@castilloa25
Copy link

castilloa25 commented Nov 14, 2024

For each ship I am going to place I need to check that the following happens. It checks if the grid is empty or if there is already other ships on the grid that are taking up coordinates where I will not be able to place the current ship. Then I want to ask the user to pick a spot to place the ship and allow the user to specify the starting position and orientation (horizontal or vertical) for each ship. You will tell the user to try again if the spot he chose is not available because either the ship will not fit in the grid or it overlaps with another ship or place the ship if the user chooses an appropriate spot.

@castilloa25
Copy link
Author

castilloa25 commented Nov 14, 2024

`public class ShipPlacement {
private Grid grid;
private List ships;
private Presenter presenter;

    public ShipPlacement(Grid grid, Presenter presenter) {
        this.grid = grid;
        this.presenter = presenter;
        this.ships = new ArrayList<>();
    }

}`

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

No branches or pull requests

1 participant