parent
4d193abb64
commit
ecde0e6345
|
@ -94,14 +94,14 @@ public class Tournament implements Serializable {
|
||||||
private void calcGameSchedule() {
|
private void calcGameSchedule() {
|
||||||
Collections.shuffle(participants);
|
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<>();
|
List<Game> gameRound = new ArrayList<>();
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
for (int j = 0; j < participants.size() - 1; j += 2) {
|
for (int j = 0; j < participants.size() - 1; j += 2) {
|
||||||
gameRound.add(new Game(participants.get(j), participants.get(j+1)));
|
gameRound.add(new Game(participants.get(j), participants.get(j+1)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int j = 0; j < (participants.size() / Math.pow(2,i)); j++) {
|
for (int j = 0; j < (gameList.get(i-1).size()/2); j++) {
|
||||||
gameRound.add(new Game(null,null));
|
gameRound.add(new Game(null,null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
|
|
||||||
public class GameController {
|
public class GameController extends FXController{
|
||||||
|
|
||||||
private GameDecorator gameDecorator;
|
private GameDecorator gameDecorator;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class GameController {
|
||||||
loadContent();
|
loadContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void loadContent() {
|
public void loadContent() {
|
||||||
participantNameOne.setText(gameDecorator.getParticipantOne());
|
participantNameOne.setText(gameDecorator.getParticipantOne());
|
||||||
participantNameTwo.setText(gameDecorator.getParticipantTwo());
|
participantNameTwo.setText(gameDecorator.getParticipantTwo());
|
||||||
|
|
Loading…
Reference in New Issue