def CheckMatchBanker(g): """Played a Bank worth $10""" ret = [] if "Bank" not in g.supply: return ret for turn in g.get_turns(): treasure_count = 0 for card in turn.plays: if card_info.is_treasure(card): treasure_count += 1 if card == "Bank": if treasure_count >= 10: ret.append(achievement(turn.player.player_name, "Played a Bank worth $%d" % treasure_count)) return ret
def count_money(plays): """ Return the value of the money from playing cards in plays. This does not include money from cards like Steward or Bank, but does count Copper. plays: list of cards. """ coppersmith_ct = 0 money = 0 for card in plays: if card == 'Coppersmith': coppersmith_ct += 1 elif card == 'Copper': money += 1 + coppersmith_ct elif card_info.is_treasure(card): money += card_info.money_value(card) return money
def CheckMatchBanker(g): """Played a Bank worth $10""" ret = [] if 'Bank' not in g.supply: return ret for turn in g.get_turns(): treasure_count = 0 for card in turn.plays: if card_info.is_treasure(card): treasure_count += 1 if card == 'Bank': if treasure_count >= 10: ret.append( achievement( turn.player.player_name, "Played a Bank worth $%d" % treasure_count)) return ret
def CheckMatchBOM(g): """Bought only money and Victory.""" ret = [] cards_per_player = g.cards_accumalated_per_player() for player, card_list in cards_per_player.iteritems(): treasures = [] bad = False if g.get_player_deck(player).Resigned(): continue for card in card_list: if card_info.is_action(card): bad = True break if card_info.is_treasure(card): treasures.append(card) if not bad: reason = 'Bought only money and vp : %s' % (', '.join(treasures)) ret.append(achievement(player, reason)) return ret
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, # 1 * cycle (vault, cellar, .. ) # 100 * win rate ]
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, # 1 * cycle (vault, cellar, .. ) # 100 * win rate ]