Update PopulationGoal.java woops

This commit is contained in:
Dennis Weinberger 2019-03-26 19:54:24 +00:00
parent 92fab9ea41
commit d41993521c

View file

@ -69,7 +69,7 @@ public class PopulationGoal extends Goal {
if(highPopulationPlayers.size() == 1) {
return highPopulationPlayers.get(0);
} else if(highPopulationPlayers.size() > 1) {
// Spieler mit insgesamt größter Bevölkerung gewinnt
// Spieler mit meisten regionen gewinnt
Comparator<Player> comp = new Comparator<Player>() {
@ -80,17 +80,13 @@ public class PopulationGoal extends Goal {
};
Collections.sort(playerList, comp);
// Edge Case: Mind. Zwei spieler haben die gleiche Anzahl an Burgen
if(playerList.get(0).getNumRegions(game) == playerList.get(1).getNumRegions(game)) {
Collections.sort(highPopulationPlayers, comp);
// Edge Case: Mehrere Spieler haben auch die gleiche Anzahl an Regionen. Dann gibt es ein Draw.
if(highPopulationPlayers.get(0).getNumRegions(game) == highPopulationPlayers.get(1).getNumRegions(game)) {
isDraw = true;
return null;
}
return Collections.max(playerList, comp);
}
return Collections.max(highPopulationPlayers, comp);
// Ansonsten... gewinnt noch kein spieler.
return null;