def num_plus_actions(card): return card_info.num_plus_actions(card)
if acceptable_func(card): num_rows += 1 new_cards = [] new_mat = np.zeros((num_rows, existing_matrix.shape[1])) for card, row in zip(existing_card_names, existing_matrix): if acceptable_func(card): 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,
def action_balance_deck_extractor(deck_comp, game_state, player): ret = 0 for card, quant in deck_comp.iteritems(): ret += (ci.num_plus_actions(card) - ci.is_action(card)) * quant return [ret / (sum(deck_comp.itervalues()) or 1)]
for card in existing_card_names: if acceptable_func(card): num_rows += 1 new_cards = [] new_mat = np.zeros((num_rows, existing_matrix.shape[1])) for card, row in zip(existing_card_names, existing_matrix): if acceptable_func(card): 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,
def action_balance_deck_extractor(deck_comp, game_state, player): ret = 0.0 for card, quant in deck_comp.iteritems(): ret += (ci.num_plus_actions(card) - ci.is_action(card)) * quant return [ret / (sum(deck_comp.itervalues()) or 1)]