Ejemplo n.º 1
0
def card_supply_events(game_obj):
    yield ''
    for card1 in game_obj.get_supply():
        c1_index = str(card_info.card_index(card1))
        yield c1_index
        for card2 in game_obj.get_supply():
            c2_index = str(card_info.card_index(card2))
            if c1_index > c2_index:
                yield c1_index + ',' + c2_index
Ejemplo n.º 2
0
def card_supply_events(game_obj):
    yield ''
    for card1 in game_obj.get_supply():
        c1_index = str(card_info.card_index(card1))
        yield c1_index
        for card2 in game_obj.get_supply():
            c2_index = str(card_info.card_index(card2))
            if c1_index > c2_index:
                yield c1_index + ',' + c2_index
Ejemplo n.º 3
0
def accumulate_card_stats(games_stream, stats_accumulator, max_games=-1):
    ct = 0
    for game in games_stream:
        detected_events = detect_events(game)

        per_player_accum = game.cards_accumalated_per_player().iteritems()
        for player, accum_dict in per_player_accum:
            avail = analysis_util.available_cards(game, accum_dict.keys())
            win_points = game.get_player_deck(player).WinPoints()
            for card in avail:
                count = accum_dict.get(card, 0)
                small_gain_stat = SmallGainStat()
                if count:
                    small_gain_stat.win_given_any_gain.add_outcome(win_points)
                else:
                    small_gain_stat.win_given_no_gain.add_outcome(win_points)
                small_gain_stat.win_weighted_gain.add_many_outcomes(
                    win_points, count)
                card_index = str(card_info.card_index(card))
                stats_accumulator.merge_stats(detected_events, card_index,
                                              small_gain_stat)
        max_games -= 1
        if max_games == 0:
            break
Ejemplo n.º 4
0
def accumulate_card_stats(games_stream, stats_accumulator, max_games=-1):
    ct = 0
    for game in games_stream:
        detected_events = detect_events(game)

        per_player_accum = game.cards_accumalated_per_player().iteritems()
        for player, accum_dict in per_player_accum:
            avail = analysis_util.available_cards(game, accum_dict.keys())
            win_points = game.get_player_deck(player).WinPoints()
            for card in avail:
                count = accum_dict.get(card, 0)
                small_gain_stat = SmallGainStat()
                if count:
                    small_gain_stat.win_given_any_gain.add_outcome(win_points)
                else:
                    small_gain_stat.win_given_no_gain.add_outcome(win_points)
                small_gain_stat.win_weighted_gain.add_many_outcomes(
                    win_points, count)
                card_index = str(card_info.card_index(card))
                stats_accumulator.merge_stats(detected_events, card_index,
                                              small_gain_stat)
        max_games -= 1
        if max_games == 0:
            break
Ejemplo n.º 5
0
 def str_card_index(self, card_name):
     title = card_info.sane_title(card_name)
     if title:
         return str(card_info.card_index(title))
     return ''
Ejemplo n.º 6
0
 def score(self, card):
     return self.score_ind(card_info.card_index(card))
Ejemplo n.º 7
0
 def score(self, card):
     return self.score_ind(card_info.card_index(card))