def process(self): units_stats = {unit.str_id: {} for unit in self.heroes} team_damage = 0 for i in range(self.n_sim): attack_team = self.attack_gauntlet[0] defense_team = self.defense_gauntlet[0] game = Game(attack_team, defense_team, copy_attack=False, copy_defense=False) game.process() winner = game.winner self.compute_winner(winner) if self.test_team == 1: unit = game.attack_team.heroes[self.test_pos - 1] add_dicts(units_stats[unit.str_id], unit.stats) team_damage += sum([ game.stats['damage'][h.str_id] for h in game.attack_team.heroes ]) elif self.test_team == 2: unit = game.defense_team.heroes[self.test_pos - 1] add_dicts(units_stats[unit.str_id], unit.stats) team_damage += sum([ game.stats['damage'][h.str_id] for h in game.defense_team.heroes ]) del game del self.attack_gauntlet[0] del self.defense_gauntlet[0] for unit in self.heroes: rescale_dict(units_stats[unit.str_id], 1 / self.n_sim) unit.stats = units_stats[unit.str_id] team_damage *= 1 / self.n_sim self.team_damage = round(team_damage) self.stats = { key: {u.str_id: u.stats[key] for u in self.heroes + self.pets} for key in self.heroes[0].stats.keys() }
def process(self): units_stats = {unit.str_id: {} for unit in self.heroes + self.pets} for i in range(self.n_sim): defense_team = self.gauntlet[0] game = Game(self.attack_team, defense_team, copy_defense=False) game.process() winner = game.winner self.compute_winner(winner) for unit in game.attack_team.heroes + [game.attack_team.pet]: add_dicts(units_stats[unit.str_id], unit.stats) del game del self.gauntlet[0] for unit in self.heroes + self.pets: rescale_dict(units_stats[unit.str_id], 1 / self.n_sim) unit.stats = units_stats[unit.str_id] self.stats = { key: {u.str_id: u.stats[key] for u in self.heroes + self.pets} for key in self.heroes[0].stats.keys() }
def process(self): units_stats = {unit.str_id: {} for unit in self.heroes + self.pets} for i in range(self.n_sim): game = Game(self.attack_team, self.defense_team, max_turns=self.max_turns) game.process() winner = game.winner self.compute_winner(winner) for unit in game.heroes + game.pets: add_dicts(units_stats[unit.str_id], unit.stats) del game for unit in self.heroes + self.pets: rescale_dict(units_stats[unit.str_id], 1 / self.n_sim) unit.stats = units_stats[unit.str_id] self.stats = { key: {u.str_id: u.stats[key] for u in self.heroes + self.pets} for key in self.heroes[0].stats.keys() }