private void BuildInitialPositionLists(List <Player> players) { foreach (var player in players) { switch (player.PlayerPosition) { case "PG": PointGuards.Add(player); TopPointGuards.Add(player); break; case "SG": ShootingGuards.Add(player); TopShootingGuards.Add(player); break; case "SF": SmallForwards.Add(player); TopSmallForwards.Add(player); break; case "PF": PowerForwards.Add(player); TopPowerForwards.Add(player); break; case "C": Centers.Add(player); break; } } }
public void OptimizeCombinations(List <NBALineup> lineups) { Console.WriteLine("Before Optimization"); DisplayCombinations(); TopPointGuards.Clear(); TopPowerForwards.Clear(); TopShootingGuards.Clear(); TopSmallForwards.Clear(); foreach (var lineup in lineups) { if (!TopPointGuards.Contains(lineup.PointGuard1)) { TopPointGuards.Add(lineup.PointGuard1); } if (!TopPointGuards.Contains(lineup.PointGuard2)) { TopPointGuards.Add(lineup.PointGuard2); } if (!TopShootingGuards.Contains(lineup.ShootingGuard1)) { TopShootingGuards.Add(lineup.ShootingGuard1); } if (!TopShootingGuards.Contains(lineup.ShootingGuard2)) { TopShootingGuards.Add(lineup.ShootingGuard2); } if (!TopSmallForwards.Contains(lineup.SmallForward1)) { TopSmallForwards.Add(lineup.SmallForward1); } if (!TopSmallForwards.Contains(lineup.SmallForward2)) { TopSmallForwards.Add(lineup.SmallForward2); } if (!TopPowerForwards.Contains(lineup.PowerForward1)) { TopPowerForwards.Add(lineup.PowerForward1); } if (!TopPowerForwards.Contains(lineup.PowerForward2)) { TopPowerForwards.Add(lineup.PowerForward2); } } Console.WriteLine("After Optimaztion"); BuildCombinations(); }