Merge pull request 'kommentar-check' (#28) from kommentar-check into main

Reviewed-on: #28
This commit is contained in:
Luca Conte 2024-12-23 20:37:06 +00:00
commit 30360c7bd4
23 changed files with 210 additions and 36 deletions

View File

@ -1,14 +1,12 @@
/**
* Die Klasse AiPlayer ist die Basis für alle Ki Spieler und jede Spezifische Ki erweitert diese Klasse.
* @author Florian und Florian
* */
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
/**
* Die Klasse AiPlayer ist die Basis für alle Ki Spieler und jede Spezifische Ki erweitert diese Klasse.
* @author Florian Alexy und Florian Hantzschel
* */
public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
@ -18,6 +16,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Konstruktor
* @author Florian Alexy und Florian Hantzschel
*/
public AiPlayer() {
this.setName("AI Player");
@ -27,6 +26,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Gibt einen zufälligen Punkt im Spielfeld zurück.
* @return Ein zufälliger Punkt
* @author Florian Alexy und Florian Hantzschel
*/
public Point RandomPoint() {
Random random = new Random(); // Pseudo Random für zufallszahlen
@ -38,6 +38,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Initialisiert das Board.
* @param size größe des Boards
* @author Florian Alexy und Florian Hantzschel
*/
@Override
public void createBoard(int size) {
@ -48,6 +49,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Ki Methode zum zufälligen Setzten der Schiffe
* @author Florian Alexy und Florian Hantzschel
*/
public void aiSetShips() {
for(int i = 0; i < super.board.getShips().size(); i++) { // Interiert durch alle Shiffe
@ -58,6 +60,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
}
/**
* Ki Methode zum zufälligen Schießen auf das gegnerische Board.
* @author Florian Alexy und Florian Hantzschel
*/
public void aiShoot() {
if (!this.myTurn) return;
@ -65,7 +68,12 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
return;
}
/**
* Nachdem receiveShoot beim gegner den schuss verarbeitet hat,
* wird diese Methode mit der antwort aufgerufen.
* @param hitResponse the hitresponse
* @author Florian Alexy und Florian Hantzschel und Luca Conte
*/
@Override
public synchronized void receiveHit(HitResponse hitResponse) {
// Eltern-Klasse LocalPlayer updatet myTurn
@ -79,6 +87,11 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
}
/**
* Erhält einen schuss vom gegner und verarbeitet ihn.
* @param point the location to be shot
* @author Florian Alexy und Florian Hantzschel und Luca Conte
*/
@Override
public synchronized void receiveShoot(Point point) {
super.receiveShoot(point);
@ -92,6 +105,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Wird aufgerufen, wenn in determineCoinToss festgestellt wurde das die Ki anfängt.
* Erster Schuss wird gestartet.
* @author Florian Alexy und Florian Hantzschel und Luca Conte
*/
@Override
public void beginTurn() {
@ -102,7 +116,7 @@ public abstract class AiPlayer extends LocalPlayer implements Runnable {
/**
* Closes past threads and tries firing a shot.
* @author Luca Conte
* @author Luca Conte, Florian Alexy und Florian Hantzschel
*/
public void run() {
Iterator<Thread> i = this.shootThreads.iterator();

View File

@ -9,7 +9,7 @@ import java.net.Socket;
/**
* Provides an Interface to communicate using a socket asynchronously
* @author Luca Conte
* @author Luca Conte, Peer Ole Wachtel
*/
public class AsyncSocket {
private Socket socket;

View File

@ -1,4 +1,5 @@
/**
* defines a message listener for AsyncSockets
* @author Luca Conte
*/
public interface AsyncSocketListener {

View File

@ -1,13 +1,12 @@
import java.util.ArrayList;
import java.util.List;
/**
* Diese Klasse ist das Board von eimem spieler und enthält alle logischen operationen.
* Sprich ist das Backend Board.
*
* @author Peer Ole Wachtel, Florian Alexy und Florian Hantzschel
*/
import java.util.ArrayList;
import java.util.List;
public class Board {
/**
@ -41,7 +40,7 @@ public class Board {
}
/**
* Nimmt einen punkt entgegen und Gibt einen Hitrespons zurück.
* Nimmt einen punkt entgegen und Gibt einen HitResponse zurück.
* @param point auf den geschossen wurde
* @return
* @author Peer Ole Wachtel
@ -104,7 +103,9 @@ public class Board {
}
/**
* returns a list of all the Ships on the board
* @return a list of all the Ships on the board
* @author Peer Ole Wachtel
*/
public List<Ship> getShips() {
return ships;
@ -117,7 +118,7 @@ public class Board {
* to all adjacened hit responses with type HIT using `propagateSunk`.
* @param hitResponse the HitResponse to be added
* @return true when the hit response was added, otherwise false
*
* @author Peer Ole Wachtel, Luca Conte
*/
public synchronized boolean addHits(HitResponse hitResponse) {
if (this.getHitResponseOnPoint(hitResponse.getPoint()) == null){
@ -149,7 +150,9 @@ public class Board {
}
/**
* returns the size of the board
* @return the size of the board
* @author Florian Alexy, Florian Hantzschel
*/
public int getSize() {
return this.size;

View File

@ -39,7 +39,7 @@ public class BoardDisplay extends JPanel {
}
/**
* Konstruktor der startLocalGame.
* Konstruktor des Board Displays
* @param gridSize Die Größe des Spielfelds
* @param player Der Spieler
* @author Lucas Bronson

View File

@ -225,6 +225,11 @@ public class GameBoard extends JPanel {
public Player getP1() {
return p1;
}
/**
* Getter für Player2
* @return Player 2
* @author Luca Conte
*/
public Player getP2() {
return p2;
}

View File

@ -14,6 +14,7 @@ public class GameController {
private static MainFrame mainFrame;
/**
* returns the current MainFrame
* @return the current MainFrame
* @author Luca Conte
*/
@ -21,6 +22,7 @@ public class GameController {
return GameController.mainFrame;
}
/**
* sets the current MainFrame
* @param mainFrame the current MainFrame
* @author Luca Conte
*/
@ -124,7 +126,7 @@ public class GameController {
/**
* finds the largest common version in two lists of version strings
* @return null if no common versions are found
* @return null if no common versions are found otherwise returns the most recent version present in both lists
* @author Luca Conte
*/
public static String findMostRecentVersion(List<String> versions1, List<String> versions2) {

View File

@ -1,6 +1,6 @@
/**
* Hauptklasse über die der MainFrame gestartet wird
* @author Lucas Bronson, Ole Wachtel, Joshua Kuklok
* @author Lucas Bronson, Peer Ole Wachtel, Joshua Kuklok
*/
public class HalloSchiffeVersenken {
@ -8,6 +8,7 @@ public class HalloSchiffeVersenken {
* Erstellt und setzt den Mainframe
* @param args Argumente an Main durch Konsole etc.
* @throws InterruptedException
* @author Peer Ole Wachtel
*/
public static void main(String[] args) throws InterruptedException {
MainFrame mf = new MainFrame();

View File

@ -1,5 +1,10 @@
/**
* Eine Antwort auf einen Schuss
* enthält einen Punkt, auf den geschossen wurde, sowie einen typen,
* der angibt, ob es sich bei dem Schuss um einen Treffer handelt
* @author Peer Ole Wachtel
*/
public class HitResponse {
/**
* Speichert den typ der HitResponse.
@ -37,10 +42,20 @@ public class HitResponse {
}
}
/**
* returns the type of the HitResponse
* @return the type of the HitResponse
* @author Florian Hantzschel
*/
public HitResponseType getHitResponse() {
return this.type;
}
/**
* returns the point of the HitResponse
* @return the point of the HitResponse
* @author Florian Hantzschel
*/
public Point getPoint() {
return this.point;
}

View File

@ -1,4 +1,8 @@
/**
* Repräsentiert einen menschlichen Spieler
* @author Luca Conte, Florian Hantzschel
*/
public class HumanPlayer extends LocalPlayer {
/**
* shoots a shot onto the provided point on the enemy board

View File

@ -1,5 +1,10 @@
import java.util.Random;
/**
* repräsentiert einen Player, der Lokal an dem Gerät spielt,
* auf dem dieses Programm läuft
* @author Luca Conte, Peer Ole Wachtel, Florian Hantzschel
*/
public class LocalPlayer extends Player {
@ -77,6 +82,7 @@ public class LocalPlayer extends Player {
/**
* sends shot to enemy player.
* should ONLY be called on HumanPlayer
* @author Luca Conte
*/
@Override
public void shoot(Point point){

View File

@ -6,6 +6,7 @@ import javax.swing.*;
/**
* Klasse für Erstellung von looseScreen Objekten
* Dient zur Anzeige das ein Spiel verloren wurde
* @author Joshua Kuklok, Luca Bronson
*/
public class LoseScreen extends JPanel {
JLabel loseLabel = new JLabel("Du hast Verloren");

View File

@ -126,7 +126,7 @@ public class MainFrame extends JFrame {
* Spezifische ShowPanel für WinScreen Klasse
* @param panelName Name des anzuzeigenden Panels
* @param player Player von dem die funktion aufgerufen worden ist
* @author Lucas Bronson, Peer Ole Wachtel
* @author Lucas Bronson, Peer Ole Wachtel, Luca Conte
*/
public void showPanelWin(String panelName, Player player){
if(player != gameBoard.getP1()){
@ -149,7 +149,7 @@ public class MainFrame extends JFrame {
* Spezifische ShowPanel für LooseScreen Klasse
* @param panelName Name des anzuzeigenden Panels
* @param player Player von dem die funktion aufgerufen worden ist
* @author Lucas Bronson, Peer Ole Wachtel
* @author Lucas Bronson, Peer Ole Wachtel, Luca Conte
*/
public void showPanelLose(String panelName, Player player){
if(player != gameBoard.getP1()){
@ -169,7 +169,7 @@ public class MainFrame extends JFrame {
}
/**
* Aktualisiert das Spielfeld (kontextText)
* Aktualisiert das Spielfeld
* @author Luca Conte
*/
public void refreshGameBoard() {

View File

@ -1,3 +1,8 @@
/**
* Abstrakte Repräsentation eines Spielers, der an einem anderen gerät spielt
* und durch eine Online Verbindung mit dieser Instanz kommuniziert
* @author Luca Conte, Peer Ole Wachtel
*/
public abstract class OnlinePlayer extends Player implements AsyncSocketListener {
protected AsyncSocket socket;
protected int wantedBoardSize;
@ -9,19 +14,33 @@ public abstract class OnlinePlayer extends Player implements AsyncSocketListener
* @param size the size of the board the enemy player wants to play with
* the actual board size will be determined once the semester of the online partner is known
* @param socket an AsyncSocket to communicate with the enemy through
* @author Peer Ole Wachtel, Luca Conte
*/
public OnlinePlayer(Integer size, AsyncSocket socket) {
this.socket = socket;
this.wantedBoardSize = size;
this.myCoin = null;
socket.setHandler(this);
//TODO Auto-generated constructor stub
}
/**
* sends the IAM Package for introduction
* @author Luca Conte
*/
public abstract void sendIAM();
/**
* receives a message from the AsyncSocket
* satisfies AsyncSocketListener interface
* @author Luca Conte
*/
public abstract void receive(String message);
/**
* receives the coin toss result from the enemy
* @param coin the result of the coin toss
* @author Peer Ole Wachtel
*/
@Override
public abstract void receiveCoin(boolean coin);

View File

@ -1,6 +1,18 @@
import java.util.List;
/**
* eine Implementierung des Kommunikationsprotokoll nach Version 1.1.0 des Netzwerkstandards
* https://github.com/lgc-4/ProgProjekt-Netzwerkstandard
* @author Peer Ole Wachtel, Luca Conte
*/
public class OnlinePlayer_1_1_0 extends OnlinePlayer {
/**
* Erstellt einen Online Player
* @param size die maximale Größe des Spielfelds
* @param socket der Socket zur Kommunikation mit dem Online Partner
*/
public OnlinePlayer_1_1_0(Integer size, AsyncSocket socket) {
super(size, socket);
}
@ -107,7 +119,7 @@ public class OnlinePlayer_1_1_0 extends OnlinePlayer {
* receives a shot from the enemy and sends it to the online partner
* if it is not the enemies turn, this method does nothing.
* @param point the point to be shot
* @author Peer Ole Wachtel
* @author Peer Ole Wachtel, Luca Conte
*/
@Override
public synchronized void receiveShoot(Point point){
@ -118,7 +130,7 @@ public class OnlinePlayer_1_1_0 extends OnlinePlayer {
/**
* receives a hitresponse from the enemy player and sends it to the online partner
* @param hitResponse the hitresponse to be sent
* @author Peer Ole Wachtel
* @author Peer Ole Wachtel, Luca Conte
*/
@Override
public synchronized void receiveHit(HitResponse hitResponse) {
@ -152,12 +164,22 @@ public class OnlinePlayer_1_1_0 extends OnlinePlayer {
}
}
/**
* für Online Player nicht zu implementieren
* nur für HumanPlayer relevant
* @author Luca Conte, Peer Ole Wachtel
*/
@Override
public synchronized void shoot(Point point) {
// SHOULD NEVER BE CALLED ON ONLINE PLAYER. ONLY ON HUMAN PLAYER
return;
}
/**
* empfängt Withdraw vom Gegner und leitet es an den Online Partner weiter
* beendet das Spiel
* @author Luca Conte
*/
@Override
public void receiveWithdraw() {
this.socket.send(new SocketPackage("WITHDRAW"));

View File

@ -1,3 +1,7 @@
/**
* abstrakte repräsentation eines Spielers
* @author Peer Ole Wachtel, Luca Conte, Lucas Bronson
*/
public abstract class Player {
protected boolean myTurn;
protected boolean isServer;
@ -12,6 +16,10 @@ public abstract class Player {
protected boolean hasReceivedCoin;
/**
* Konstruktor
* @author Peer Ole Wachtel, Luca Conte
*/
public Player() {
this.setName("Player");
this.hasReceivedCoin = false;
@ -29,10 +37,25 @@ public abstract class Player {
this.board = new Board(size);
}
/**
* receives a shot onto a point from the enemy
* @param point the location to be shot
* @author Luca Conte, Peer Ole Wachtel
*/
public abstract void receiveShoot(Point point);
/**
* receives a hit response from the enemy as a response to a receiveShoot call
* @param hitResponse the hitresponse
* @author Peer Ole Wachtel
*/
public abstract void receiveHit(HitResponse hitResponse);
/**
* sends shot to enemy player.
* should ONLY be called on HumanPlayer
* @author Luca Conte
*/
public abstract void shoot(Point point);
/**
@ -60,6 +83,7 @@ public abstract class Player {
public void setName(String name) {
this.name = name;
}
/**
* returns the name of this player
* @return the name of this player
@ -126,6 +150,7 @@ public abstract class Player {
/**
* returns whether this player is ready and has sent their coin to the enemy player
* @return the player's ready state
* @author Lucas Bronson
*/
public boolean isReady() {
return this.sentCoin;
@ -137,7 +162,6 @@ public abstract class Player {
* and players
*
* This method should be called at the end of a game
* This method should be called at the end of a game
*
* @author Luca Conte
*/
@ -148,18 +172,39 @@ public abstract class Player {
this.enemy = null;
}
/**
* the player wins
* ends the game
* @author Luca Conte
*/
public void win() {
GameController.getMainFrame().showPanelWin("", this);
}
/**
* the player loses
* ends the game
* @author Luca Conte
*/
public void lose() {
GameController.getMainFrame().showPanelLose("", this);
}
/**
* the player loses by withdrawal
* ends the game
* @author Luca Conte
*/
public void withdraw() {
this.enemy.receiveWithdraw();
this.lose();
}
/**
* the enemy player withdraws
* ends the game
* @author Luca Conte
*/
public void receiveWithdraw(){
this.win();
}

View File

@ -1,3 +1,7 @@
/**
* repräsentation der Koordinaten eines Feldes auf dem Spielfeld
* @author Peer Ole Wachtel, Luca Conte
*/
public class Point {
private int x;
private int y;

View File

@ -5,6 +5,10 @@ import java.util.List;
record ShipData (int size, String name){}
/**
* repräsentation eines Schiffes auf dem Spielfeld
* @author Peer Ole Wachtel, Lucas Bronson, Florian Hanzschel
*/
public class Ship {
static List<List<ShipData>> semeterList =
Arrays.asList(
@ -189,7 +193,7 @@ public class Ship {
/**
* returns the position of this ship
* @return the position of this ship
* @author Peer Ole Wachte
* @author Peer Ole Wachtel
*/
public Point getPosition() {
return position;

View File

@ -1,6 +1,8 @@
import java.util.Arrays;
import java.util.List;
/**
* beschreibt ein Package das durch einen AsyncSocket gesendet werden kann nach Netzwerkstandard
* https://github.com/lgc-4/ProgProjekt-Netzwerkstandard
* @author Luca Conte
*/
public class SocketPackage {
@ -88,6 +90,7 @@ public class SocketPackage {
* parses the package into a string according to https://github.com/lgc-4/ProgProjekt-Netzwerkstandard
* the package name and data are joined using a space " " `0x20`
* @return the package in string format
* @author Luca Conte
*/
public String toString() {
if (this.data == null || this.data.length() == 0) {

View File

@ -1,10 +1,10 @@
import java.util.ArrayList;
// import java.util.Random; wird nicht mehr verwendet
/**
* Diese Klasse implementiert den Harten Ki Spieler.
* @author Florian Alexy und Florian Hantzschel
* */
import java.util.ArrayList;
// import java.util.Random; wird nicht mehr verwendet
public class SpecificAiPlayerHard extends AiPlayer{
private int gridSize;
@ -21,7 +21,8 @@ public class SpecificAiPlayerHard extends AiPlayer{
VERTIKAL
}
private Orientierung orientierung;
private Point firstHit; // Speichert den ersten Treffer zur Bestimmung der Orientierung
// Speichert den ersten Treffer zur Bestimmung der Orientierung
private Point firstHit;
/**

View File

@ -1,10 +1,10 @@
import java.util.ArrayList;
import java.util.List;
/**
* Diese Klasse implementiert den Medium Ki Spieler.
* @author Florian Alexy und Florian Hantzschel
* */
import java.util.ArrayList;
import java.util.List;
public class SpecificAiPlayerMedium extends AiPlayer{
/**
* Liste an Punkten die beschossen werden sollen. (Mögliche weitere Segmente vom schiff)
@ -48,7 +48,7 @@ public class SpecificAiPlayerMedium extends AiPlayer{
/**
* Die Methode bestimmt welche Position als nächstes beschossen werden soll.
* @return
* @return der Punkt auf den als nächtest geschossen werden soll
* @author Florian Alexy und Florian Hantzschel
*/
public Point ComputeNextShot() {
@ -72,7 +72,7 @@ public class SpecificAiPlayerMedium extends AiPlayer{
/**
* Diese Methode erweitert die hitsQueue um die umliegenden Punkte die Schiffe seien könnten.
* @param point
* @param point der Punkt dessen nachbarn zur hitQueue hinzugefügt werden sollen
* @author Florian Alexy und Florian Hantzschel
*/
private void addAdjacentPoints(Point point) {

View File

@ -225,10 +225,13 @@ public class startLocalGame extends JPanel {
private void toggleLeftPlayerIconLeft() {
if (leftPlayerIcon.getIcon() == humanPlayerIcon) {
leftPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon){
leftPlayerIcon.setIcon(humanPlayerIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerNormalIcon) {
leftPlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerHardIcon) {
leftPlayerIcon.setIcon(aiPlayerNormalIcon);
}
@ -241,10 +244,13 @@ public class startLocalGame extends JPanel {
private void toggleLeftPlayerIconRight() {
if (leftPlayerIcon.getIcon() == humanPlayerIcon) {
leftPlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon){
leftPlayerIcon.setIcon(aiPlayerNormalIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerNormalIcon) {
leftPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (leftPlayerIcon.getIcon() == aiPlayerHardIcon) {
leftPlayerIcon.setIcon(humanPlayerIcon);
}
@ -257,8 +263,10 @@ public class startLocalGame extends JPanel {
private void toggleRightPlayerIconLeft() {
if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
rightPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon){
rightPlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
rightPlayerIcon.setIcon(aiPlayerNormalIcon);
}
@ -271,8 +279,10 @@ public class startLocalGame extends JPanel {
private void toggleRightPlayerIconRight() {
if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon) {
rightPlayerIcon.setIcon(aiPlayerNormalIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon){
rightPlayerIcon.setIcon(aiPlayerHardIcon);
} else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
rightPlayerIcon.setIcon(aiPlayerEasyIcon);
}
@ -286,10 +296,13 @@ public class startLocalGame extends JPanel {
// Für Linken Spieler
if (leftPlayerIcon.getIcon() == humanPlayerIcon) {
leftPlayerTextField.setText(leftPlayerNickname);
} else if (leftPlayerIcon.getIcon() == aiPlayerEasyIcon){
leftPlayerTextField.setText("Einfach");
} else if (leftPlayerIcon.getIcon() == aiPlayerNormalIcon) {
leftPlayerTextField.setText("Mittel");
} else if (leftPlayerIcon.getIcon() == aiPlayerHardIcon) {
leftPlayerTextField.setText("Schwer");
}
@ -297,8 +310,10 @@ public class startLocalGame extends JPanel {
// Für Rechten Spieler
if (rightPlayerIcon.getIcon() == aiPlayerEasyIcon){
rightPlayerTextField.setText("Einfach");
} else if (rightPlayerIcon.getIcon() == aiPlayerNormalIcon) {
rightPlayerTextField.setText("Mittel");
} else if (rightPlayerIcon.getIcon() == aiPlayerHardIcon) {
rightPlayerTextField.setText("Schwer");
}

View File

@ -192,10 +192,13 @@ public class startMultiplayerGame extends JPanel {
private void togglePlayerIconLeft() {
if (PlayerIcon.getIcon() == humanPlayerIcon) {
PlayerIcon.setIcon(aiPlayerHardIcon);
} else if (PlayerIcon.getIcon() == aiPlayerEasyIcon){
PlayerIcon.setIcon(humanPlayerIcon);
} else if (PlayerIcon.getIcon() == aiPlayerNormalIcon) {
PlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (PlayerIcon.getIcon() == aiPlayerHardIcon) {
PlayerIcon.setIcon(aiPlayerNormalIcon);
}
@ -208,10 +211,13 @@ public class startMultiplayerGame extends JPanel {
private void togglePlayerIconRight() {
if (PlayerIcon.getIcon() == humanPlayerIcon) {
PlayerIcon.setIcon(aiPlayerEasyIcon);
} else if (PlayerIcon.getIcon() == aiPlayerEasyIcon){
PlayerIcon.setIcon(aiPlayerNormalIcon);
} else if (PlayerIcon.getIcon() == aiPlayerNormalIcon) {
PlayerIcon.setIcon(aiPlayerHardIcon);
} else if (PlayerIcon.getIcon() == aiPlayerHardIcon) {
PlayerIcon.setIcon(humanPlayerIcon);
}
@ -224,10 +230,13 @@ public class startMultiplayerGame extends JPanel {
private void updateTextFields() {
if (PlayerIcon.getIcon() == humanPlayerIcon) {
PlayerTextField.setText(PlayerNickname);
} else if (PlayerIcon.getIcon() == aiPlayerEasyIcon){
PlayerTextField.setText("Einfach");
} else if (PlayerIcon.getIcon() == aiPlayerNormalIcon) {
PlayerTextField.setText("Mittel");
} else if (PlayerIcon.getIcon() == aiPlayerHardIcon) {
PlayerTextField.setText("Schwer");
}