def team_alloc(self, team, alloc_method='DC', show_cost=False): candidates, CC = [], CoverageCalculator(self.live, self.setting) for index, card in enumerate(team.card_list): adv_card = AdvancedCard(index, card) adv_card.list_gem_allocation(self.live) adv_card.compute_card_stats(team.center().cskill, self.guest_cskill, self.live, self.setting) adv_card.CR, adv_card.CR_list = CC.compute_coverage(card) if index == 4: center = adv_card else: candidates.append(adv_card) gem_allocator = GemAllocator([center] + candidates, self.live, self.setting, self.owned_gem) gem_allocator.allocate(alloc_method) return gem_allocator.view_optimal_details(show_cost=show_cost)
def team_strength_detail(self, team, show_cost=False): candidates, CC = [], CoverageCalculator(self.live, self.setting) for index, card in enumerate(team.card_list): adv_card = AdvancedCard(index, card) adv_card.list_gem_allocation(self.live) adv_card.compute_card_stats(team.center().cskill, self.guest_cskill, self.live, self.setting) adv_card.CR, adv_card.CR_list = CC.compute_coverage(card) if index == 4: center = adv_card else: candidates.append(adv_card) gem_allocator = GemAllocator([center] + candidates, self.live, self.setting, self.owned_gem) gem_allocator.update_gem_score() new_team = Team(candidates[:4]+[center]+candidates[4:]) return gem_allocator.view_optimal_details(show_cost=show_cost, fixed_team=new_team)
def team_alloc(self, team, alloc_method='DC', show_cost=False): candidates, CC = [], CoverageCalculator(self.live, self.setting) for index, card in enumerate(team.card_list): adv_card = AdvancedCard(index, card) adv_card.list_gem_allocation(self.live) adv_card.compute_card_stats(team.center().cskill, self.guest_cskill, self.live, self.setting) adv_card.CR = CC.compute_coverage(card) if index == 4: center = adv_card else: candidates.append(adv_card) gem_allocator = GemAllocator([center] + candidates, self.live, self.setting, self.owned_gem) gem_allocator.allocate(alloc_method) new_team = gem_allocator.construct_team() # new_team.compute_expected_total_score(self.live, opt=self.setting, verbose=True) # new_team.to_LLHelper('team.sd') # new_team.to_ieb('team.ieb') return gem_allocator.view_optimal_details(show_cost=show_cost)
def single_case(choice, center, candidates, pinned, max_score=0): gem_allocator = GemAllocator([center] + pinned + [candidates[i] for i in choice], self.live, self.setting, self.owned_gem) res = gem_allocator.allocate(alloc_method, max_score) return gem_allocator if res is not None else None