lucasjoshua #14

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

View File

@ -2,7 +2,9 @@ import java.util.Random;
public abstract class AiPlayer extends LocalPlayer { public abstract class AiPlayer extends LocalPlayer {
public AiPlayer() {} public AiPlayer() {
this.setName("AI Player");
}
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

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

View File

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

View File

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