コード例 #1
0
        private int SetTopGroupingSeed(int iteration, int insideIteration, List <Participant> orderedList)
        {
            if (iteration > orderedList.Count)
            {
                return(iteration);
            }

            var assignmentvalue = 0;

            if (insideIteration == 4)
            {
                BracketSeedOrder.Add(assignmentvalue);
                iteration += 1;
                return(iteration);
            }
            else if (insideIteration == 1)
            {
                assignmentvalue = orderedList.Count / 2;
            }
            else if (insideIteration == 2)
            {
                assignmentvalue = (orderedList.Count / 2) - 1;
            }
            else if (insideIteration == 3)
            {
                assignmentvalue = orderedList.Count - 1;
            }

            BracketSeedOrder.Add(assignmentvalue);
            iteration       += 1;
            insideIteration += 1;
            return(SetTopGroupingSeed(iteration, insideIteration, orderedList));
        }
コード例 #2
0
        public void SetEdgeCaseOrderBySeed()
        {
            if (EdgeCaseParticipants == null)
            {
                return;
            }
            EdgeCaseParticipantsInBracketOrder = new Stack <Participant>(EdgeCaseParticipants);
            var orderedList = EdgeCaseParticipantsInBracketOrder.OrderBy(k => k.Seed).ToList();

            EdgeCaseParticipantsInBracketOrder.Clear();
            var edgecaseheight = GetBracketHeight(EdgeCaseParticipants.Count, 1);
            int decrementValue = edgecaseheight - 1;

            BracketSeedOrder.Clear();
            SetBracketSeedOrder(1, 1, orderedList, decrementValue, edgecaseheight);
            AssignBracketOrderToEdgeCaseParticipants(1, edgecaseheight, orderedList);
        }
コード例 #3
0
        private int SetBracketSeedOrder(int iteration, int insideIteration, List <Participant> orderedList, int decrementValue, int depth)
        {
            var modvalue        = (depth - decrementValue);
            var assignmentvalue = 0;

            if (iteration > orderedList.Count)
            {
                return(iteration);
            }
            if (modvalue == depth)
            {
                iteration = SetTopGroupingSeed(iteration, insideIteration, orderedList);
                return(iteration);
            }
            else if (insideIteration == 4)
            {
                assignmentvalue = ((orderedList.Count / 2) - 1) - modvalue;
                BracketSeedOrder.Add(assignmentvalue);
                insideIteration = 1;
                iteration      += 1;
                decrementValue -= 1;
                iteration       = SetBracketSeedOrder(iteration, insideIteration, orderedList, decrementValue, depth);
            }
            else if (insideIteration == 1)
            {
                assignmentvalue = (orderedList.Count - modvalue) - 1;
                BracketSeedOrder.Add(assignmentvalue);
            }
            else if (insideIteration == 2)
            {
                assignmentvalue = modvalue;
                BracketSeedOrder.Add(assignmentvalue);
            }
            else if (insideIteration == 3)
            {
                assignmentvalue = (orderedList.Count / 2) + modvalue;
                BracketSeedOrder.Add(assignmentvalue);
            }

            iteration       += 1;
            insideIteration += 1;
            return(SetBracketSeedOrder(iteration, insideIteration, orderedList, decrementValue, depth));
        }