File size: 1,626 Bytes
1790bde
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Official 2026 FIFA World Cup knockout bracket template (verified).

Slots: ("W", g)=winner of group g, ("RU", g)=runner-up, ("3", frozenset)=a
best third-placed team drawn from one of the listed groups (FIFA Annex C)."""
from __future__ import annotations

S = frozenset

# Round of 32: match id -> (slotA, slotB)
R32 = {
    73: (("RU", "A"), ("RU", "B")),
    74: (("W", "E"), ("3", S("ABCDF"))),
    75: (("W", "F"), ("RU", "C")),
    76: (("W", "C"), ("RU", "F")),
    77: (("W", "I"), ("3", S("CDFGH"))),
    78: (("RU", "E"), ("RU", "I")),
    79: (("W", "A"), ("3", S("CEFHI"))),
    80: (("W", "L"), ("3", S("EHIJK"))),
    81: (("W", "D"), ("3", S("BEFIJ"))),
    82: (("W", "G"), ("3", S("AEHIJ"))),
    83: (("RU", "K"), ("RU", "L")),
    84: (("W", "H"), ("RU", "J")),
    85: (("W", "B"), ("3", S("EFGIJ"))),
    86: (("W", "J"), ("RU", "H")),
    87: (("W", "K"), ("3", S("DEIJL"))),
    88: (("RU", "D"), ("RU", "G")),
}

# Later rounds: match id -> (feeder_match_a, feeder_match_b)
FEED = {
    89: (74, 77), 90: (73, 75), 91: (76, 78), 92: (79, 80),
    93: (83, 84), 94: (81, 82), 95: (86, 88), 96: (85, 87),
    97: (89, 90), 98: (93, 94), 99: (91, 92), 100: (95, 96),
    101: (97, 98), 102: (99, 100),
    104: (101, 102),
}

# The 8 R32 matches whose second slot is a third-placed team
THIRD_SLOTS = {mid: b[1] for mid, (a, b) in R32.items() if b[0] == "3"}

STAGE_OF = {}
for _m in R32:
    STAGE_OF[_m] = "R32"
for _m in (89, 90, 91, 92, 93, 94, 95, 96):
    STAGE_OF[_m] = "R16"
for _m in (97, 98, 99, 100):
    STAGE_OF[_m] = "QF"
for _m in (101, 102):
    STAGE_OF[_m] = "SF"
STAGE_OF[104] = "F"