third place
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { GroupId, GROUP_IDS, Match, Team } from "./types";
|
||||
import { computeGroupTables } from "./standings";
|
||||
import { resolveAnnexC } from "./bracket";
|
||||
import { computeGroupTables, computeThirdPlaceTable } from "./standings";
|
||||
import { resolveAnnexC, qualifiedThirdGroups } from "./bracket";
|
||||
|
||||
// Repräsentative Ergebnis-Varianten je Restspiel (decken alle Punktkombinationen ab).
|
||||
const OUTCOMES: Array<[number, number]> = [
|
||||
@@ -174,7 +174,21 @@ export function thirdSlotIsSecure(winnerGroup: GroupId, matches: Match[], teams:
|
||||
const states = buildThirdStates(matches, teams);
|
||||
const { lockedIn, contested } = classifyGroups(states);
|
||||
|
||||
if (lockedIn.size > 8) return false;
|
||||
if (lockedIn.size > 8) {
|
||||
// Alle Gruppen fertig oder zu viele lockedIn → die 8 tatsächlich qualifizierten
|
||||
// Dritten bestimmen (nicht die 12 lockedIn-Gruppen).
|
||||
const tables = computeGroupTables(teams, matches);
|
||||
const thirds = computeThirdPlaceTable(tables);
|
||||
const qGroups = qualifiedThirdGroups(thirds);
|
||||
if (qGroups.length !== 8) return false;
|
||||
const assignment = resolveAnnexC(qGroups);
|
||||
if (!assignment) return false;
|
||||
const ag = assignment[winnerGroup];
|
||||
if (!ag) return false;
|
||||
const ss = states.get(ag);
|
||||
if (!ss) return false;
|
||||
return ss.finished && ss.third != null && ss.possibleTeamIds.size === 1;
|
||||
}
|
||||
|
||||
if (lockedIn.size === 8) {
|
||||
const assignment = resolveAnnexC([...lockedIn]);
|
||||
|
||||
Reference in New Issue
Block a user