public static IList<SimulatedPlayer> SetupPlayers(IList<Type> strategies) { IList<SimulatedPlayer> spelers = new List<SimulatedPlayer>(); Dictionary<string, int> nameCount = new Dictionary<string, int>(); for (int i = 0; i < strategies.Count; i++) { ISimulatieSpeler strategy = (ISimulatieSpeler) System.Activator.CreateInstance(strategies[i]); string naam = strategy.Naam; if (naam.Length > 60) { naam = naam.Substring(0, 60); } if (nameCount.ContainsKey(naam)) { nameCount[naam]++; naam += "_" + nameCount[naam].ToString().PadLeft(2, '0'); } else { nameCount.Add(naam, 1); naam = naam + "_01"; } SimulatedPlayer speler = new SimulatedPlayer(naam, strategy); spelers.Add(speler); } return spelers; }
public Match(int matchId, SimulatedPlayer player1, SimulatedPlayer player2) { this.matchId = matchId; this.player1 = player1; this.player2 = player2; }