Added Ex. 10
added client hosts a server added javadoc comments
This commit is contained in:
@@ -155,7 +155,6 @@ public void received(MapMessage msg, int from) {
|
||||
|
||||
/**
|
||||
* Validates the placement of battleships on the map.
|
||||
*
|
||||
* Ensures that:
|
||||
* <ul>
|
||||
* <li>The number of ships matches the configuration.</li>
|
||||
|
||||
@@ -52,10 +52,14 @@ public ShipMapDTO(ShipMap map) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current ship map fits the game details provided.
|
||||
* Checks if the ship map is compatible with the provided game details.
|
||||
*
|
||||
* @param details the game details to be matched against
|
||||
* @return true if the ship map fits the game details, false otherwise
|
||||
* This method verifies that the ship map's dimensions match the game details,
|
||||
* that the total number of ships is correct, and that the ship placements
|
||||
* do not overlap and stay within the map boundaries.
|
||||
*
|
||||
* @param details the game details containing required dimensions and ship configurations
|
||||
* @return true if the ship map fits the game details; false otherwise
|
||||
*/
|
||||
public boolean fits(GameDetails details) {
|
||||
if (width != details.getWidth() || height != details.getHeight())
|
||||
|
||||
Reference in New Issue
Block a user