public void generateTeams() { foreach (Player g1 in mGolfer1) { Team team = new Team(); team.addPlayer(g1); foreach (Player g2 in mGolfer2) { if (g2.Equals(g1)) { continue; } team.addPlayer(g2); foreach (Player g3 in mGolfer3) { if (g3.Equals(g1) || g3.Equals(g2)) { continue; } team.addPlayer(g3); foreach (Player g4 in mGolfer4) { if (g4.Equals(g1) || g4.Equals(g2) || g4.Equals(g3)) { continue; } team.addPlayer(g4); foreach (Player g5 in mGolfer5) { if (g5.Equals(g1) || g5.Equals(g2) || g5.Equals(g3) || g5.Equals(g4)) { continue; } team.addPlayer(g5); foreach (Player g6 in mGolfer6) { if (g6.Equals(g1) || g6.Equals(g2) || g6.Equals(g3) || g6.Equals(g4) || g6.Equals(g5)) { continue; } team.addPlayer(g6); addTeam(new Team(team)); team.removePlayer(g6); } team.removePlayer(g5); } team.removePlayer(g4); } team.removePlayer(g3); } team.removePlayer(g2); } team.removePlayer(g1); } }
public void generateTeams() { foreach (Player g in mFixedGoalie) { Team team = new Team(); team.addPlayer(g); foreach (Player c1 in mFixedCenter1) { team.addPlayer(c1); foreach (Player c2 in mFixedCenter2) { if (c2.Equals(c1)) { continue; } team.addPlayer(c2); foreach (Player w1 in mFixedWinger1) { team.addPlayer(w1); foreach (Player w2 in mFixedWinger2) { if (w2.Equals(w1)) { continue; } team.addPlayer(w2); foreach (Player w3 in mFixedWinger3) { if (w3.Equals(w1) || w3.Equals(w2)) { continue; } team.addPlayer(w3); foreach (Player d1 in mFixedDefense1) { team.addPlayer(d1); foreach (Player d2 in mFixedDefense2) { if (d2.Equals(d1)) { continue; } team.addPlayer(d2); foreach (Player util in mFixedUtility) { if (util.Equals(c1) || util.Equals(c2) || util.Equals(w1) || util.Equals(w2) || util.Equals(w3) || util.Equals(d1) || util.Equals(d2)) { continue; } 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); } } }
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(); }
public void generateTopNFLTeams() { foreach (Player qb in mFixedQBList) { Team team = new Team(); team.addPlayer(qb); foreach (Player rb1 in mFixedRB1List) { team.addPlayer(rb1); foreach (Player rb2 in mFixedRB2List) { if (rb2.Equals(rb1)) { continue; } team.addPlayer(rb2); foreach (Player wr1 in mFixedWR1List) { team.addPlayer(wr1); foreach (Player wr2 in mFixedWR2List) { if (wr2.Equals(wr1)) { continue; } team.addPlayer(wr2); foreach (Player wr3 in mFixedWR3List) { if (wr3.Equals(wr1) || wr3.Equals(wr2)) { continue; } team.addPlayer(wr3); foreach (Player te in mFixedTEList) { team.addPlayer(te); foreach (Player dst in mFixedDSTList) { team.addPlayer(dst); foreach (Player flex in mFixedFlexList) { if (flex.Equals(te) || flex.Equals(wr1) || flex.Equals(wr2) || flex.Equals(wr3) || flex.Equals(rb1) || flex.Equals(rb2)) { continue; } 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); } } }
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(); }
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); } }
private void generateTeams() { foreach (Player f1 in fixedForward1) { Team team = new Team(); team.addPlayer(f1); foreach (Player f2 in fixedForward2) { if (f2.Equals(f1)) { continue; } team.addPlayer(f2); foreach (Player f3 in fixedForward3) { if (f3.Equals(f2) || f3.Equals(f1)) { continue; } team.addPlayer(f3); foreach (Player g1 in fixedGuard1) { team.addPlayer(g1); foreach (Player g2 in fixedGuard2) { if (g2.Equals(g1)) { continue; } team.addPlayer(g2); foreach (Player g3 in fixedGuard3) { 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; } 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); } team.removePlayer(f1); } }
private void generateTeams() { foreach(Player f1 in fixedForward1) { Team team = new Team(); team.addPlayer(f1); foreach(Player f2 in fixedForward2) { if (f2.Equals(f1)) { continue; } team.addPlayer(f2); foreach(Player f3 in fixedForward3) { if (f3.Equals(f2) || f3.Equals(f1)) { continue; } team.addPlayer(f3); foreach(Player g1 in fixedGuard1) { team.addPlayer(g1); foreach(Player g2 in fixedGuard2) { if (g2.Equals(g1)) { continue; } team.addPlayer(g2); foreach(Player g3 in fixedGuard3) { 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; } 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); } team.removePlayer(f1); } }
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(); }