Skip to content

Commit

Permalink
Fixed Double Eliminations test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cpapplefamily committed Nov 30, 2024
1 parent e99faa9 commit e4cb317
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
112 changes: 56 additions & 56 deletions playoff/double_elimination.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{2},
blueAllianceSource: allianceSelectionSource{3},
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 540),
}
m2 := Matchup{
id: "M2",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{1},
blueAllianceSource: matchupSource{matchup: &m1, useWinner: true},
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 540),
}
m3 := Matchup{
id: "M3",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m2, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m1, useWinner: false},
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 540),
}

// Define final matches.
Expand All @@ -47,9 +47,9 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

// Define scheduled breaks.
breakSpecs := []breakSpec{
/* {5, 480, "Field Break"},
{9, 480, "Field Break"},
{11, 480, "Field Break"},
/* {5, 540, "Field Break"},
{9, 540, "Field Break"},
{11, 540, "Field Break"},
{13, 900, "Awards Break"},
{14, 900, "Awards Break"},
{15, 900, "Awards Break"},
Expand All @@ -64,21 +64,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{1},
blueAllianceSource: allianceSelectionSource{4},
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 540),
}
m2 := Matchup{
id: "M2",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{2},
blueAllianceSource: allianceSelectionSource{3},
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 540),
}
m3 := Matchup{
id: "M3",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m1, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m2, useWinner: true},
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 540),
}
m4 := Matchup{
id: "M4",
Expand All @@ -94,7 +94,7 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m4, useWinner: true},
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 540),
}

// Define final matches.
Expand All @@ -108,9 +108,9 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

// Define scheduled breaks.
breakSpecs := []breakSpec{
/* {5, 480, "Field Break"},
{9, 480, "Field Break"},
{11, 480, "Field Break"},
/* {5, 540, "Field Break"},
{9, 540, "Field Break"},
{11, 540, "Field Break"},
{13, 900, "Awards Break"},
{14, 900, "Awards Break"},
{15, 900, "Awards Break"},
Expand All @@ -125,21 +125,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{4},
blueAllianceSource: allianceSelectionSource{5},
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 540),
}
m2 := Matchup{
id: "M2",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{2},
blueAllianceSource: allianceSelectionSource{3},
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 540),
}
m3 := Matchup{
id: "M3",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{1},
blueAllianceSource: matchupSource{matchup: &m1, useWinner: true},
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 540),
}
m4 := Matchup{
id: "M4",
Expand All @@ -155,21 +155,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m2, useWinner: true},
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 540),
}
m6 := Matchup{
id: "M6",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m4, useWinner: true},
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 540),
}
m7 := Matchup{
id: "M7",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m5, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m6, useWinner: true},
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 480),
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 540),
}

// Define final matches.
Expand All @@ -183,9 +183,9 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

// Define scheduled breaks.
breakSpecs := []breakSpec{
//{5, 480, "Field Break"},
//{9, 480, "Field Break"},
//{11, 480, "Field Break"},
//{5, 540, "Field Break"},
//{9, 540, "Field Break"},
//{11, 540, "Field Break"},
//{13, 900, "Awards Break"},
//{14, 900, "Awards Break"},
//{15, 900, "Awards Break"},
Expand All @@ -200,21 +200,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{4},
blueAllianceSource: allianceSelectionSource{5},
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 540),
}
m2 := Matchup{
id: "M2",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{3},
blueAllianceSource: allianceSelectionSource{6},
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 540),
}
m3 := Matchup{
id: "M3",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{1},
blueAllianceSource: matchupSource{matchup: &m1, useWinner: true},
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 540),
}
m4 := Matchup{
id: "M4",
Expand All @@ -230,21 +230,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m2, useWinner: false},
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 540),
}
m6 := Matchup{
id: "M6",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m4, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m1, useWinner: false},
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 540),
}
m7 := Matchup{
id: "M7",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m4, useWinner: true},
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 480),
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 540),
}
m8 := Matchup{
id: "M8",
Expand Down Expand Up @@ -275,9 +275,9 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

// Define scheduled breaks.
breakSpecs := []breakSpec{
//{5, 480, "Field Break"},
//{9, 480, "Field Break"},
//{11, 480, "Field Break"},
//{5, 540, "Field Break"},
//{9, 540, "Field Break"},
//{11, 540, "Field Break"},
//{13, 900, "Awards Break"},
//{14, 900, "Awards Break"},
//{15, 900, "Awards Break"},
Expand All @@ -292,21 +292,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{4},
blueAllianceSource: allianceSelectionSource{5},
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 540),
}
m2 := Matchup{
id: "M2",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{3},
blueAllianceSource: allianceSelectionSource{6},
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 540),
}
m3 := Matchup{
id: "M3",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{2},
blueAllianceSource: allianceSelectionSource{7},
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 540),
}
m4 := Matchup{
id: "M4",
Expand All @@ -322,21 +322,21 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m2, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m3, useWinner: true},
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 540),
}
m6 := Matchup{
id: "M6",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m2, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m3, useWinner: false},
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 540),
}
m7 := Matchup{
id: "M7",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m1, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m5, useWinner: false},
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 480),
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 540),
}
m8 := Matchup{
id: "M8",
Expand All @@ -352,7 +352,7 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m4, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m5, useWinner: true},
matchSpecs: newDoubleEliminationMatch(9, "Round 3 Lower", 480),
matchSpecs: newDoubleEliminationMatch(9, "Round 3 Lower", 540),
}
m10 := Matchup{
id: "M10",
Expand All @@ -368,7 +368,7 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m9, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m10, useWinner: true},
matchSpecs: newDoubleEliminationMatch(11, "Round 4 Upper", 480),
matchSpecs: newDoubleEliminationMatch(11, "Round 4 Upper", 540),
}

// Define final matches.
Expand All @@ -382,9 +382,9 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

// Define scheduled breaks.
breakSpecs := []breakSpec{
//{5, 480, "Field Break"},
//{9, 480, "Field Break"},
{11, 480, "Field Break"},
//{5, 540, "Field Break"},
//{9, 540, "Field Break"},
{11, 540, "Field Break"},
{13, 900, "Awards Break"},
{14, 900, "Awards Break"},
{15, 900, "Awards Break"},
Expand All @@ -399,28 +399,28 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{1},
blueAllianceSource: allianceSelectionSource{8},
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(1, "Round 1 Upper", 540),
}
m2 := Matchup{
id: "M2",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{4},
blueAllianceSource: allianceSelectionSource{5},
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(2, "Round 1 Upper", 540),
}
m3 := Matchup{
id: "M3",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{2},
blueAllianceSource: allianceSelectionSource{7},
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 480),
matchSpecs: newDoubleEliminationMatch(3, "Round 1 Upper", 540),
}
m4 := Matchup{
id: "M4",
NumWinsToAdvance: 1,
redAllianceSource: allianceSelectionSource{3},
blueAllianceSource: allianceSelectionSource{6},
matchSpecs: newDoubleEliminationMatch(4, "Round 1 Upper", 300),
matchSpecs: newDoubleEliminationMatch(4, "Round 1 Upper", 540),
}

// Define Round 2 matches.
Expand All @@ -429,28 +429,28 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m1, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m2, useWinner: false},
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(5, "Round 2 Lower", 540),
}
m6 := Matchup{
id: "M6",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m4, useWinner: false},
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 480),
matchSpecs: newDoubleEliminationMatch(6, "Round 2 Lower", 540),
}
m7 := Matchup{
id: "M7",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m1, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m2, useWinner: true},
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 480),
matchSpecs: newDoubleEliminationMatch(7, "Round 2 Upper", 540),
}
m8 := Matchup{
id: "M8",
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m3, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m4, useWinner: true},
matchSpecs: newDoubleEliminationMatch(8, "Round 2 Upper", 300),
matchSpecs: newDoubleEliminationMatch(8, "Round 2 Upper", 540),
}

// Define Round 3 matches.
Expand All @@ -459,7 +459,7 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m7, useWinner: false},
blueAllianceSource: matchupSource{matchup: &m6, useWinner: true},
matchSpecs: newDoubleEliminationMatch(9, "Round 3 Lower", 480),
matchSpecs: newDoubleEliminationMatch(9, "Round 3 Lower", 540),
}
m10 := Matchup{
id: "M10",
Expand All @@ -475,7 +475,7 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error
NumWinsToAdvance: 1,
redAllianceSource: matchupSource{matchup: &m7, useWinner: true},
blueAllianceSource: matchupSource{matchup: &m8, useWinner: true},
matchSpecs: newDoubleEliminationMatch(11, "Round 4 Upper", 480),
matchSpecs: newDoubleEliminationMatch(11, "Round 4 Upper", 540),
}
m12 := Matchup{
id: "M12",
Expand Down Expand Up @@ -505,9 +505,9 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

// Define scheduled breaks.
breakSpecs := []breakSpec{
//{5, 480, "Field Break"},
//{9, 480, "Field Break"},
{11, 480, "Field Break"},
//{5, 540, "Field Break"},
//{9, 540, "Field Break"},
{11, 360, "Field Break"},
{13, 900, "Awards Break"},
{14, 900, "Awards Break"},
{15, 900, "Awards Break"},
Expand All @@ -516,7 +516,7 @@ func newDoubleEliminationBracket(numAlliances int) (*Matchup, []breakSpec, error

return &final, breakSpecs, nil
}else{
return nil, nil, fmt.Errorf("double-elimination bracket must have exactly 4, 6, or 8 alliances")
return nil, nil, fmt.Errorf("double-elimination bracket must have exactly 3,4,5,6, or 8 alliances")
}


Expand Down
Loading

0 comments on commit e4cb317

Please sign in to comment.