public override void createTeams(MainForm.ProgressBarIncrement inc, League league)
 {
     if (league == League.College)
     {
         generateTopCollegeBasketballTeams(inc);
     }
 }
Esempio n. 2
0
 public override void createTeams(MainForm.ProgressBarIncrement inc, League league)
 {
     if (league == League.Professional)
     {
         generateNHLTeams(inc);
     }
 }
Esempio n. 3
0
 public override void createTeams(MainForm.ProgressBarIncrement inc, League league)
 {
     throw new NotImplementedException();
 }
        public void generateTopNFLTeams(MainForm.ProgressBarIncrement inc)
        {
            int i = 0;
            int x = 0;

            foreach (Player qb in mQBList)
            {
                Team team = new Team();
                team.addPlayer(qb);
                foreach (Player rb1 in mRBList)
                {
                    team.addPlayer(rb1);
                    foreach (Player rb2 in mRBList)
                    {
                        if (rb2.Equals(rb1))
                        {
                            continue;
                        }
                        team.addPlayer(rb2);
                        foreach (Player wr1 in mWRList)
                        {
                            team.addPlayer(wr1);
                            foreach (Player wr2 in mWRList)
                            {
                                if (wr2.Equals(wr1))
                                {
                                    continue;
                                }
                                team.addPlayer(wr2);
                                foreach (Player wr3 in mWRList)
                                {
                                    if (wr3.Equals(wr1) || wr3.Equals(wr2))
                                    {
                                        continue;
                                    }
                                    team.addPlayer(wr3);
                                    foreach (Player te in mTEList)
                                    {
                                        team.addPlayer(te);
                                        foreach (Player dst in mDSTList)
                                        {
                                            team.addPlayer(dst);
                                            foreach (Player flex in mFlexList)
                                            {
                                                if (flex.Equals(te) || flex.Equals(wr1) || flex.Equals(wr2) || flex.Equals(wr3) || flex.Equals(rb1) || flex.Equals(rb2))
                                                {
                                                    continue;
                                                }
                                                i++;

                                                if (i == 10000000)
                                                {
                                                    i = 0;
                                                    x++;
                                                    if (x > 3)
                                                    {
                                                        x = 0;
                                                    }
                                                    inc.Invoke(x);
                                                }

                                                team.addPlayer(flex);
                                                addTeam(new Team(team));
                                                team.removePlayer(flex);
                                            }
                                            team.removePlayer(dst);
                                        }
                                        team.removePlayer(te);
                                    }
                                    team.removePlayer(wr3);
                                }
                                team.removePlayer(wr2);
                            }
                            team.removePlayer(wr1);
                        }
                        team.removePlayer(rb2);
                    }
                    team.removePlayer(rb1);
                }
            }

            updateProgressEvent();
        }
Esempio n. 5
0
 public abstract void createTeams(MainForm.ProgressBarIncrement inc, League league);
Esempio n. 6
0
        public override void createTeams(MainForm.ProgressBarIncrement inc, League league)
        {
            mPlayers.RemoveAll(z => mFixedPlayers.Contains(z));
            List <List <Player> > mTeamList = new List <List <Player> >();

            for (int j = 0; j < 6; j++)
            {
                mTeamList.Add(new List <Player>());
                mTeamList[j].AddRange(mPlayers);
            }

            for (int j = 0; j < mFixedPlayers.Count(); j++)
            {
                mTeamList[j].Clear();
                mTeamList[j].Add(mFixedPlayers[j]);
            }

            foreach (Player p1 in mTeamList[0])
            {
                Team team = new Team();
                team.addPlayer(p1);
                foreach (Player p2 in mTeamList[1])
                {
                    if (p2.Equals(p1))
                    {
                        continue;
                    }
                    team.addPlayer(p2);
                    foreach (Player p3 in mTeamList[2])
                    {
                        if (p3.Equals(p1) || p3.Equals(p2))
                        {
                            continue;
                        }
                        team.addPlayer(p3);
                        foreach (Player p4 in mTeamList[3])
                        {
                            if (p4.Equals(p1) || p4.Equals(p2) || p4.Equals(p3))
                            {
                                continue;
                            }
                            team.addPlayer(p4);
                            foreach (Player p5 in mTeamList[4])
                            {
                                if (p5.Equals(p1) || p5.Equals(p2) || p5.Equals(p3) || p5.Equals(p4))
                                {
                                    continue;
                                }
                                team.addPlayer(p5);
                                foreach (Player p6 in mTeamList[5])
                                {
                                    if (p6.Equals(p1) || p6.Equals(p2) || p6.Equals(p3) || p6.Equals(p4) || p6.Equals(p5))
                                    {
                                        continue;
                                    }
                                    team.addPlayer(p6);
                                    addTeam(new Team(team));
                                    team.removePlayer(p6);
                                }
                                team.removePlayer(p5);
                            }
                            team.removePlayer(p4);
                        }
                        team.removePlayer(p3);
                    }
                    team.removePlayer(p2);
                }
                team.removePlayer(p1);
            }
        }
        public void generateTopCollegeBasketballTeams(MainForm.ProgressBarIncrement inc)
        {
            int i = 0;
            int x = 0;

            foreach (Player f1 in mForwardList)
            {
                Team team = new Team();
                team.addPlayer(f1);
                foreach (Player f2 in mForwardList)
                {
                    if (f1.Equals(f2))
                    {
                        continue;
                    }
                    team.addPlayer(f2);
                    foreach (Player f3 in mForwardList)
                    {
                        if (f3.Equals(f2) || f3.Equals(f1))
                        {
                            continue;
                        }
                        team.addPlayer(f3);
                        foreach (Player g1 in mGuardList)
                        {
                            team.addPlayer(g1);
                            foreach (Player g2 in mGuardList)
                            {
                                if (g2.Equals(g1))
                                {
                                    continue;
                                }
                                team.addPlayer(g2);
                                foreach (Player g3 in mGuardList)
                                {
                                    if (g3.Equals(g1) || g3.Equals(g2))
                                    {
                                        continue;
                                    }
                                    team.addPlayer(g3);
                                    foreach (Player u1 in mUtilList)
                                    {
                                        if (u1.Equals(g1) || u1.Equals(g2) || u1.Equals(g3) || u1.Equals(f1) || u1.Equals(f2) || u1.Equals(f3))
                                        {
                                            continue;
                                        }
                                        team.addPlayer(u1);
                                        foreach (Player u2 in mUtilList)
                                        {
                                            if (u2.Equals(u1) || u2.Equals(g1) || u2.Equals(g2) || u2.Equals(g3) || u2.Equals(f1) || u2.Equals(f2) || u2.Equals(f3))
                                            {
                                                continue;
                                            }
                                            i++;

                                            //should eventually refactor this, pull this out from all of the Generators, have it as a protected method in GenerateTeams abstract class, and have that abstract class upon receiving
                                            // the "progress bar inc" variable set that progress bar for future use, would remove this ugly chunk of code from all calculators, lots less duplicated code.
                                            if (i == 10000000)
                                            {
                                                i = 0;
                                                x++;
                                                if (x > 3)
                                                {
                                                    x = 0;
                                                }
                                                inc.Invoke(x);
                                            }

                                            team.addPlayer(u2);
                                            addTeam(new Team(team));
                                            team.removePlayer(u2);
                                        }
                                        team.removePlayer(u1);
                                    }
                                    team.removePlayer(g3);
                                }
                                team.removePlayer(g2);
                            }
                            team.removePlayer(g1);
                        }
                        team.removePlayer(f3);
                    }
                    team.removePlayer(f2);
                }
            }

            updateProgressEvent();
        }
Esempio n. 8
0
        public void generateNHLTeams(MainForm.ProgressBarIncrement inc)
        {
            int i = 0;
            int x = 0;

            foreach (Player g in mGoalieList)
            {
                Team team = new Team();
                team.addPlayer(g);
                foreach (Player c1 in mCenterList)
                {
                    team.addPlayer(c1);
                    foreach (Player c2 in mCenterList)
                    {
                        if (c2.Equals(c1))
                        {
                            continue;
                        }
                        team.addPlayer(c2);
                        foreach (Player w1 in mWingerList)
                        {
                            team.addPlayer(w1);
                            foreach (Player w2 in mWingerList)
                            {
                                if (w2.Equals(w1))
                                {
                                    continue;
                                }
                                team.addPlayer(w2);
                                foreach (Player w3 in mWingerList)
                                {
                                    if (w3.Equals(w1) || w3.Equals(w2))
                                    {
                                        continue;
                                    }
                                    team.addPlayer(w3);
                                    foreach (Player d1 in mDefenseList)
                                    {
                                        team.addPlayer(d1);
                                        foreach (Player d2 in mDefenseList)
                                        {
                                            if (d2.Equals(d1))
                                            {
                                                continue;
                                            }
                                            team.addPlayer(d2);
                                            foreach (Player util in mUtilList)
                                            {
                                                if (util.Equals(c1) || util.Equals(c2) || util.Equals(w1) || util.Equals(w2) || util.Equals(w3) || util.Equals(d1) || util.Equals(d2))
                                                {
                                                    continue;
                                                }
                                                i++;

                                                if (i == 10000000)
                                                {
                                                    i = 0;
                                                    x++;
                                                    if (x > 3)
                                                    {
                                                        x = 0;
                                                    }
                                                    inc.Invoke(x);
                                                }

                                                team.addPlayer(util);
                                                addTeam(new Team(team));
                                                team.removePlayer(util);
                                            }
                                            team.removePlayer(d2);
                                        }
                                        team.removePlayer(d1);
                                    }
                                    team.removePlayer(w3);
                                }
                                team.removePlayer(w2);
                            }
                            team.removePlayer(w1);
                        }
                        team.removePlayer(c2);
                    }
                    team.removePlayer(c1);
                }
            }

            updateProgressEvent();
        }