Develope game branch #33

Merged
schrom01 merged 23 commits from develope_Game_branch into main 2022-05-12 13:44:47 +02:00
2 changed files with 10 additions and 4 deletions
Showing only changes of commit de728745f6 - Show all commits

View File

@ -94,18 +94,18 @@ public class Tournament implements Serializable {
private void calcGameSchedule() {
Collections.shuffle(participants);
for (int i = 0; i < (Math.log(participants.size()) / Math.log(2)); i++) {
for (int i = 0; i <= (Math.log(participants.size()) / Math.log(2)); i++) {
List<Game> gameRound = new ArrayList<>();
if (i == 0) {
for (int j = 0; j < participants.size() - 1; j += 2) {
gameRound.add(new Game(participants.get(j), participants.get(j+1)));
}
gameList.add(gameRound);
} else {
for (int j = 0; j < (participants.size() / Math.pow(2,i)); j++) {
gameRound.add(new Game(null,null));
}
}
gameList.add(gameRound);
}
}

View File

@ -37,12 +37,18 @@ public class GameDecorator {
}
public String getParticipantOne() {
if (game.getParticipant1() != null) {
return game.getParticipant1().getName();
}
return "1";
}
public String getParticipantTwo() {
if (game.getParticipant2() != null) {
return game.getParticipant2().getName();
}
return "2";
}
public Place getLocation() {
return game.getPlace();