set player names

This commit is contained in:
Luca Conte 2024-12-15 12:40:12 +01:00
parent d3f5421808
commit 80b5d8e701
4 changed files with 10 additions and 3 deletions

View File

@ -2,7 +2,9 @@ import java.util.Random;
public abstract class AiPlayer extends LocalPlayer {
public AiPlayer() {}
public AiPlayer() {
this.setName("AI Player");
}
public Point RandomPoint() {
Random random = new Random(); // Pseudo Random für zufallszahlen
int posx = random.nextInt(super.board.getSize()); // Generiert 0 - 13

View File

@ -166,6 +166,8 @@ public class GameController {
localPlayer.setEnemy(aiPlayer);
aiPlayer.setEnemy(localPlayer);
localPlayer.setName(localPlayerName);
startGameWithInstancedPlayers(localPlayer, aiPlayer, size);
}

View File

@ -1,5 +1,3 @@
import java.util.Random;
public abstract class Player {
protected boolean myTurn;
protected boolean isServer;
@ -14,6 +12,7 @@ public abstract class Player {
protected boolean haseReceivedCoin;
public Player() {
this.setName("Player");
this.haseReceivedCoin = false;
this.sendCoin = false;
}

View File

@ -5,6 +5,10 @@ public class SpecificAiPlayerMedium extends AiPlayer{
private List<Point> hitsQueue = new ArrayList<>();
public SpecificAiPlayerMedium() {
this.setName("AI Player Medium");
}
@Override
public void AiShoot() {
Point nextShot = ComputeNextShot();