def CheckMatchMrGreenGenes(g): """Bought 6 differently named Victory cards""" accumed_per_player = g.cards_accumalated_per_player() ret = [] for player, card_dict in accumed_per_player.iteritems(): victory_quants = [(c, q) for c, q in card_dict.iteritems() if card_info.is_victory(c)] if len(victory_quants) >= 6: ret.append(achievement(player, 'Bought %d differently named Victory cards' % len(victory_quants), len(victory_quants))) return ret
def CheckMatchMrGreenGenes(g): """Bought 6 differently named Victory cards""" accumed_per_player = g.cards_accumalated_per_player() ret = [] for player, card_dict in accumed_per_player.iteritems(): victory_quants = [(c, q) for c, q in card_dict.iteritems() if card_info.is_victory(c)] if len(victory_quants) >= 6: ret.append( achievement( player, 'Bought %d differently named Victory cards' % len(victory_quants), len(victory_quants))) return ret
def CheckMatchMrGreenGenes(g): accumed_per_player = g.cards_accumalated_per_player() ret = [] for player, card_dict in accumed_per_player.iteritems(): victory_quants = [(c, q) for c, q in card_dict.iteritems() if card_info.is_victory(c)] if len(victory_quants) >= 6: ret.append({ 'player': player, 'reason': 'Bought %d differently named Victory cards' % len(victory_quants)} ) return ret
def has_vp(card): return card_info.is_victory(card)
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 ]
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, # 1 * cycle (vault, cellar, .. ) # 100 * win rate ]
def score_silk_road(deck_comp): return sum(deck_comp[card] if card_info.is_victory(card) else 0 for card in deck_comp) / 4 * deck_comp['Silk Road']