2023-10-05 23:32:29 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "Spiel" file from Author: Philipp Kotte
|
|
|
|
written on: 05 / 10 / 2023 at: 23:25
|
|
|
|
============================================================
|
|
|
|
*/
|
|
|
|
package Facade;
|
|
|
|
|
2023-10-10 12:38:27 +02:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import Domain.Spieler;
|
|
|
|
import Domain.Enums.Geschlecht;
|
|
|
|
|
2023-10-05 23:32:29 +02:00
|
|
|
public class Spiel {
|
|
|
|
|
2023-10-10 12:38:27 +02:00
|
|
|
private boolean istGestartet;
|
|
|
|
private boolean istBeendet;
|
|
|
|
private Spieler spielerAmZug;
|
|
|
|
private int runde;
|
2023-10-10 14:09:27 +02:00
|
|
|
private HashMap<Integer, Spieler> spieler = new HashMap<>();
|
|
|
|
private boolean[] id_check = { false, false, false, false, false, false };
|
2023-10-10 12:38:27 +02:00
|
|
|
|
|
|
|
public Spiel() {
|
|
|
|
this.istGestartet = false;
|
|
|
|
this.istBeendet = false;
|
|
|
|
this.spielerAmZug = null;
|
|
|
|
this.runde = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
public void addSpieler(String name, Geschlecht geschlecht) {
|
2023-10-10 14:09:27 +02:00
|
|
|
int id = 1;
|
|
|
|
while (id_check[id - 1]) {
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
Spieler temp = new Spieler(id, name, geschlecht);
|
|
|
|
this.spieler.put(id, temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removeSpieler(int id_spieler) {
|
|
|
|
this.spieler.remove(id_spieler);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String[] getAlleSpieler() {
|
|
|
|
String[] spieler = new String[this.spieler.size()];
|
|
|
|
for (int i = 0; i < spieler.length - 1; i++) {
|
|
|
|
spieler[i] = spieler[i].toString();
|
|
|
|
}
|
|
|
|
return spieler;
|
2023-10-10 12:38:27 +02:00
|
|
|
}
|
|
|
|
|
2023-10-05 23:32:29 +02:00
|
|
|
}
|
2023-10-10 14:09:27 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @Override
|
|
|
|
* public String toString(){
|
|
|
|
* return "Name: " + this.getName() + ", ID: " + this.getID();
|
|
|
|
* }
|
|
|
|
*/
|