Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bracket can now be imbalanced #60

Closed
wants to merge 1 commit into from
Closed

Conversation

NMerkley
Copy link

Support for non power of 2 brackets.
Any undefined part of a team gets handled as a "bye" game in the first round, which is hidden from rendering. This can be done automatically by setting the unevenBracket option to true and nesting the teams array one level deeper, with one array for each round.
The styling could maybe use some love, but this is a start

jquery-bracket-imbalanced

{
    "teams": [
        [
            ["Team 7", "Team 8"],
            ["Team 9", "Team 10"]
        ],
        [
            ["Team 1"],
            ["Team 2", "Team 3"],
            ["Team 4"],
            ["Team 5", "Team 6"]
        ]
    ],
    "results": [
        [
            [[2, 1], [0, 3]],
            [[3, 0], [2, 1], [1, 2], [2, 1]],
            [[2, 1], [1, 2]],
            [[3, 0]]
        ],[
            [[1, 2], [1, 2]],
            [[2, 1], [0, 3]],
            [[1, 2], [2, 1]],
            [[3, 0]],
            [[2, 1]]
        ],[
            [[1, 2], [0, 3]],
            [[0, 3]]
        ]
    ]
}

@teijo
Copy link
Owner

teijo commented Mar 26, 2016

Thanks for the PR!

I have a bit mixed feelings about the approach of changing the input data structure and having additional configuration parameter for it. I feel something like this would be more straightforward evolution from the current state and would be more easily supported in the edit mode:

{
    "teams": [
        ["Team 1"],
        ["Team 7", "Team 8"],
        ["Team 2"]
        ["Team 3"],
        ["Team 4"],
        ["Team 9", "Team 10"],
        ["Team 5"],
        ["Team 6"]
    ],
    "results": [
        [
            [[], [2, 1], [], [], [], [0, 3], [], []],
// identical
        ],[
// identical
        ]
    ]
}

Having empty arrays for scores or partials for teams might not be the way to go but instead have some serializable placeholder to fill the blanks (can't really say until trying to code it). For example, additional data can be included to matches which relies on it being the third value for scores: http://www.aropupu.fi/bracket/#matches.

What do you think?

@teijo
Copy link
Owner

teijo commented Oct 19, 2016

BYEs (non power of 2) are now available in version 0.8.0.

http://www.aropupu.fi/bracket/#save

@teijo teijo closed this Oct 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants