示例#1
0
        public void DrawGrid(SingleEliminationGrid grid, GridType type)
        {
            var allTeams      = new List <Team>(_team);
            var oneTourLength = _nameLength + 4;
            var countTours    = grid.CountTours;

            if (grid.Tours[grid.CountTours].Games.Count != 1)
            {
                countTours++;
            }

            _rightBorder = 2 * oneTourLength * countTours + 1;

            int lastTour = grid.Tours.Count;

            if (type == GridType.DoubleGrid && grid.Tours[lastTour - 1].Games.Count == 1)
            {
                lastTour--;
            }

            for (int i = 0; i < lastTour; i++)
            {
                int lastgame = GetMiddleGame(grid.Tours[i].Games.Count);

                for (int j = 0; j < grid.Tours[i].Games.Count; j++)
                {
                    var currentGame = grid.Tours[i].Games[j];

                    if (j < lastgame || type == GridType.StandardGrid)
                    {
                        DrawBranch(true, i, j, currentGame);
                    }
                    else
                    {
                        DrawBranch(false, i, j - lastgame, currentGame);
                    }
                }
            }

            PrintChampion(grid.CountTours + 1, grid.Champion, type);
            Console.CursorTop = _maxCursorTop + 1;
            _team             = allTeams;
        }
        public void StartNextTour()
        {
            SetFinalGame();

            if (WinnersTour.Champion != null)
            {
                LosersTour.StartNextTour();
                return;
            }

            var teams = GetLoserTeamsFromWinnersTour();

            if (LosersTour != null)
            {
                LosersTour.Tours[LosersTour.CountTours]._extraTeams.AddRange(teams);
                LosersTour.StartNextTour();
            }
            else
            {
                LosersTour = new SingleEliminationGrid(teams);
            }

            WinnersTour.StartNextTour();
        }
 public DoubleEliminationGrid(List <Team> teams)
 {
     WinnersTour = new SingleEliminationGrid(teams);
 }