Commit fdedfe99 authored by Tomáš Strachoň's avatar Tomáš Strachoň
Browse files

feat: allow playoffs generation for all elimination matches

parent 1d0b53c7
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -83,15 +83,26 @@ namespace TournamentManager.HelperFunctions

        public static void WriteBracket(StreamWriter file, List<Match> matches, TournamentStrategy strategy)
        {
            if ((strategy == TournamentStrategy.Elimination && matches.Count > 8) || strategy == TournamentStrategy.AllAgainstAll)
            if (strategy == TournamentStrategy.AllAgainstAll)
            {
                return;
            }

            int offset = 0;

            if (strategy == TournamentStrategy.Groups)
            {
                offset = Match.groupMatchesTotal;
            }
            else if (strategy == TournamentStrategy.Elimination && matches.Count > 8)
            {
                offset = matches.Count - 8;
            }

            file.WriteLine("\n\nPlayoffs bracket");

            List<List<string>> grid = [];
            FillGrid(grid, matches, strategy == TournamentStrategy.Groups ? Match.groupMatchesTotal : 0);
            FillGrid(grid, matches, offset);

            foreach (var row in grid)
            {