Ejemplo n.º 1
0
        private FinalistData GetShallowNode()
        {
            FinalistData node = null;

            int shallowest = int.MaxValue;

            foreach (FinalistData fn in SingleEliminationFinal.GetFinalists())
            {
                INode n     = fn.GetNode();
                int   depth = n.GetNodeDepth();
                if (shallowest > depth)
                {
                    shallowest = depth;
                    node       = fn;
                }
            }

            return(node);
        }
Ejemplo n.º 2
0
        private bool DoMerge()
        {
            bool canMerge = CanMerge();

            if (canMerge)
            {
                FinalistData first = GetShallowNode();
                SingleEliminationFinal.RemoveFinalist(first);

                FinalistData second = GetShallowNode();
                SingleEliminationFinal.RemoveFinalist(second);

                MatchNode newMatch = GenerateMatchNode();
                newMatch.AddFinalist(first);
                newMatch.AddFinalist(second);

                SingleEliminationFinal.AddFinalist(newMatch, MatchOutcome.OneVsOneWinner);
                SingleEliminationGames.Add(newMatch);

                canMerge = CanMerge();
            }

            return(canMerge);
        }