Example #1
0
        public static HeroGroup CreateGroup(int size)
        {
            HeroGroup group = new HeroGroup();

            int fails = 0;

            while (group.Heroes.Count != size)
            {
                HeroData hero = group.Suggest();
                if (hero != null)
                {
                    group.Heroes.Add(hero);
                }
                else
                {
                    fails += 1;
                }

                if (fails >= 100)
                {
                    return(CreateGroup(size - 1));
                }
            }

            return(group);
        }
Example #2
0
        public static HeroGroup CreateGroup(int size)
        {
            HeroGroup heroGroup = new HeroGroup();
            int       num       = 0;

            while (heroGroup.Heroes.Count != size)
            {
                HeroData heroDatum = heroGroup.Suggest();
                if (heroDatum == null)
                {
                    num++;
                }
                else
                {
                    heroGroup.Heroes.Add(heroDatum);
                }
                if (num < 100)
                {
                    continue;
                }
                return(HeroGroup.CreateGroup(size - 1));
            }
            return(heroGroup);
        }