lucasjoshua #14

Merged
lgc merged 13 commits from lucasjoshua into main 2024-12-15 13:27:15 +00:00
1 changed files with 4 additions and 1 deletions
Showing only changes of commit 256d769ccf - Show all commits

View File

@ -51,7 +51,6 @@ public class Ship {
private String name; private String name;
private int hitsOnMe; private int hitsOnMe;
private boolean sunk; private boolean sunk;
private boolean isPlaced;
public Ship (int size, String name) { public Ship (int size, String name) {
this.size = size; this.size = size;
@ -63,6 +62,10 @@ public class Ship {
this.isPlaced = false; this.isPlaced = false;
} }
public void resetPosition() {
this.position = null;
}
public boolean setPosition(Point pos, List<Ship> shipsList, int boardSize) { public boolean setPosition(Point pos, List<Ship> shipsList, int boardSize) {
// ueberpruefe boundaries // ueberpruefe boundaries
if (pos.getX() < 0 || pos.getY() < 0 || pos.getX() >= boardSize || pos.getY() >= boardSize) { if (pos.getX() < 0 || pos.getY() < 0 || pos.getX() >= boardSize || pos.getY() >= boardSize) {