Пример #1
0
def score_deck(deck_comp):
    """ Given a dict of card, frequency, return the score. """
    ret = 0
    if 'Gardens' in deck_comp:
        ret += score_gardens(deck_comp)
    if 'Duke' in deck_comp:
        ret += score_duke(deck_comp)
    if 'Fairgrounds' in deck_comp:
        ret += score_fairgrounds(deck_comp)
    if 'Vineyard' in deck_comp:
        ret += score_vineyard(deck_comp)

    for card in deck_comp:
        ret += card_info.vp_per_card(card) * deck_comp[card]

    return ret
Пример #2
0
def score_deck(deck_comp):
    """ Given a dict of card, frequency, return the score. """
    ret = 0
    if 'Gardens' in deck_comp:
        ret += score_gardens(deck_comp)
    if 'Duke' in deck_comp:
        ret += score_duke(deck_comp)
    if 'Fairgrounds' in deck_comp:
        ret += score_fairgrounds(deck_comp)
    if 'Vineyard' in deck_comp:
        ret += score_vineyard(deck_comp)
    if 'Silk Road' in deck_comp:
        ret += score_silk_road(deck_comp)

    for card in deck_comp:
        ret += card_info.vp_per_card(card) * deck_comp[card]

    return ret
Пример #3
0
def score_deck(deck_comp):
    """ Given a dict of card, frequency, return the score. """
    ret = 0
    if "Gardens" in deck_comp:
        ret += score_gardens(deck_comp)
    if "Duke" in deck_comp:
        ret += score_duke(deck_comp)
    if "Fairgrounds" in deck_comp:
        ret += score_fairgrounds(deck_comp)
    if "Vineyard" in deck_comp:
        ret += score_vineyard(deck_comp)
    if "Silk Road" in deck_comp:
        ret += score_silk_road(deck_comp)

    for card in deck_comp:
        ret += card_info.vp_per_card(card) * deck_comp[card]

    return ret
Пример #4
0
            new_cards.append(card)
    return new_mat, new_cards


# http://forum.dominionstrategy.com/index.php?topic=647.msg8951#msg8951
bonus_feature_funcs = [
    lambda x: 2 * card_info.coin_cost(x),
    lambda x: 3 * card_info.potion_cost(x),
    lambda x: 3 * card_info.num_plus_actions(x),
    lambda x: 4 * card_info.num_plus_cards(x),
    lambda x: 4 * card_info.is_action(x),
    lambda x: 4 * card_info.is_victory(x),
    lambda x: 4 * card_info.is_treasure(x),
    lambda x: 5 * card_info.is_attack(x),
    lambda x: 1 * card_info.is_reaction(x),
    lambda x: 2 * card_info.vp_per_card(x),
    lambda x: 1 * card_info.money_value(x),
    lambda x: 1 * card_info.num_plus_buys(x),
    # 1 * gains (remodel, upgrade, workshop, ...)
    lambda x: 1 * max(card_info.trashes(x), 5)
    # 6 * pollute (can add to other deck)
    # 3 * combo (conspirator, peddler, ...
    # 3 * special (goons, gardens, uniqueness in general)
    # 3 * discard (militia, minion,
    # 1 * cycle (vault, cellar, .. )
    # 100 * win rate
]


def get_bonus_vec(card_name):
    bonus_vec = np.zeros(len(bonus_feature_funcs))
Пример #5
0
            new_mat[len(new_cards)] = row
            new_cards.append(card)
    return new_mat, new_cards

# http://forum.dominionstrategy.com/index.php?topic=647.msg8951#msg8951
bonus_feature_funcs = [
    lambda x: 2 * card_info.coin_cost(x),
    lambda x: 3 * card_info.potion_cost(x),
    lambda x: 3 * card_info.num_plus_actions(x),
    lambda x: 4 * card_info.num_plus_cards(x),
    lambda x: 4 * card_info.is_action(x),
    lambda x: 4 * card_info.is_victory(x),
    lambda x: 4 * card_info.is_treasure(x),
    lambda x: 5 * card_info.is_attack(x),
    lambda x: 1 * card_info.is_reaction(x),
    lambda x: 2 * card_info.vp_per_card(x),
    lambda x: 1 * card_info.money_value(x),
    lambda x: 1 * card_info.num_plus_buys(x),
    # 1 * gains (remodel, upgrade, workshop, ...)
    lambda x: 1 * max(card_info.trashes(x), 5)
    # 6 * pollute (can add to other deck)
    # 3 * combo (conspirator, peddler, ...
    # 3 * special (goons, gardens, uniqueness in general)
    # 3 * discard (militia, minion, 
    # 1 * cycle (vault, cellar, .. )
    # 100 * win rate
    ]

def get_bonus_vec(card_name):
    bonus_vec = np.zeros(len(bonus_feature_funcs))
    for j, feature_func in enumerate(bonus_feature_funcs):