mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-26 19:34:36 +00:00
Increase coalition condition to 2/3 share to avoid three-way-tie case
This commit is contained in:
@@ -180,7 +180,10 @@ export function computeClanTeamName(players: PlayerInfo[]): string | null {
|
||||
// Coalition: top two clans cover the majority of humans
|
||||
if (sorted.length >= 2) {
|
||||
const [secondTag, secondCount] = sorted[1];
|
||||
if ((topCount + secondCount) / total > 0.5) {
|
||||
if (
|
||||
(topCount + secondCount) / total > 2 / 3 &&
|
||||
secondCount / total >= 0.25
|
||||
) {
|
||||
return `${topTag} / ${secondTag}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,11 @@ describe("computeClanTeamName", () => {
|
||||
expect(computeClanTeamName(players)).toBe("ALPHA / BETA");
|
||||
});
|
||||
|
||||
it("returns null when three distinct clans each hold one player", () => {
|
||||
const players = [human("1", "ALPHA"), human("2", "BETA"), human("3", "GAMMA")];
|
||||
expect(computeClanTeamName(players)).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when no players have clan tags", () => {
|
||||
const players = [human("1"), human("2"), human("3")];
|
||||
expect(computeClanTeamName(players)).toBeNull();
|
||||
|
||||
Reference in New Issue
Block a user