fix: remove board size from constructor

This commit is contained in:
Luca Conte 2024-11-30 18:28:05 +01:00
parent 998ff3d663
commit cecc44abf4
6 changed files with 2 additions and 23 deletions

View File

@ -1,10 +1,8 @@
import java.util.Random; import java.util.Random;
public abstract class AiPlayer extends Player { public abstract class AiPlayer extends LocalPlayer {
public AiPlayer(int size) { public AiPlayer() {}
super(size);
}
public Point RandomPoint() { public Point RandomPoint() {
Random random = new Random(); // Pseudo Random für zufallszahlen Random random = new Random(); // Pseudo Random für zufallszahlen
int posx = random.nextInt(super.board.getSize()); // Generiert 0 - 13 int posx = random.nextInt(super.board.getSize()); // Generiert 0 - 13

View File

@ -1,7 +1,4 @@
public class HumanPlayer extends LocalPlayer { public class HumanPlayer extends LocalPlayer {
public HumanPlayer(int size) {
super(size);
}
} }

View File

@ -1,9 +1,5 @@
public class LocalPlayer extends Player { public class LocalPlayer extends Player {
LocalPlayer(int size) {
super(size);
}
@Override @Override
public synchronized void receiveShoot(Point point) { public synchronized void receiveShoot(Point point) {
HitResponse hitResponse = board.getHitResponsOnPoint(point); HitResponse hitResponse = board.getHitResponsOnPoint(point);

View File

@ -1,7 +1,3 @@
public class SpecificAiPlayerEasy extends AiPlayer{ public class SpecificAiPlayerEasy extends AiPlayer{
public SpecificAiPlayerEasy(int size) {
super(size);
}
} }

View File

@ -1,7 +1,3 @@
public class SpecificAiPlayerHard extends AiPlayer{ public class SpecificAiPlayerHard extends AiPlayer{
public SpecificAiPlayerHard(int size) {
super(size);
}
} }

View File

@ -5,10 +5,6 @@ public class SpecificAiPlayerMedium extends AiPlayer{
private List<Point> hitsQueue = new ArrayList<>(); private List<Point> hitsQueue = new ArrayList<>();
public SpecificAiPlayerMedium(int size) {
super(size);
}
@Override @Override
public void AiShoot() { public void AiShoot() {
Point nextShot = ComputeNextShot(); Point nextShot = ComputeNextShot();