Added Ex. 10

added client hosts a server
added javadoc comments
This commit is contained in:
Cedric Beck
2024-10-06 14:29:31 +02:00
parent 216bd60d84
commit 5edd4ebe0b
10 changed files with 392 additions and 46 deletions

View File

@@ -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>

View File

@@ -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())