Skip to content

Commit

Permalink
Added Champions bracket seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
Foulest committed Dec 8, 2024
1 parent 29860d6 commit b2f33cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ private void simulateBracket(Map<Team, Map<String, Integer>> results) {
records.put(team, new int[]{0, 0}); // [wins, losses]
}

// Sort teams by their seeding in ascending order
// Sort teams by their champion seeding in ascending order
List<Team> seededTeams = new ArrayList<>(teams);
seededTeams.sort(Comparator.comparingInt(Team::getSeeding));
seededTeams.sort(Comparator.comparingInt(Team::getChampionSeed));

List<Team> activeTeams = seededTeams.stream()
.map(Team::clone) // Clone or copy each team
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/foulest/swiss/team/Team.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
public class Team implements Cloneable {

private String name;
private int seeding; // Higher number = better seed
private int worldRanking; // Lower number = better rank
private int seeding; // Higher number = better seed
private int championSeed; // Where the team is seeded in the championship bracket

// The average player rating is calculated by adding each player's
// HLTV 2.1 rating from the past 3 months together and dividing by five
Expand Down Expand Up @@ -68,6 +69,6 @@ public int hashCode() {

@Override
public Team clone() {
return new Team(name, worldRanking, seeding, avgPlayerRating);
return new Team(name, worldRanking, seeding, championSeed, avgPlayerRating);
}
}

0 comments on commit b2f33cb

Please sign in to comment.