コード例 #1
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def average_agendas_scored_to_win(cards, identity=None, **kwargs):
    points_to_win = 7
    if identity.name == "Harmony Medtech: Biomedical Pioneer":
        points_to_win = 6
    agendas = data.get_cards_of_type('agenda', cards)
    num_agendas = data.get_total_cards(agendas)
    total_agenda_points = data.sum_over_attr('agendapoints', agendas, convert_type=int)
    points_per_agenda = float(total_agenda_points) / float(num_agendas) 
    num_scored_to_win = float(points_to_win) / points_per_agenda
    if int(num_scored_to_win) == num_scored_to_win:
        return int(num_scored_to_win)
    return round(num_scored_to_win, 2)
コード例 #2
0
def average_agendas_scored_to_win(cards, identity=None, **kwargs):
    points_to_win = 7
    if identity.name == "Harmony Medtech: Biomedical Pioneer":
        points_to_win = 6
    agendas = data.get_cards_of_type('agenda', cards)
    num_agendas = data.get_total_cards(agendas)
    total_agenda_points = data.sum_over_attr('agendapoints',
                                             agendas,
                                             convert_type=int)
    points_per_agenda = float(total_agenda_points) / float(num_agendas)
    num_scored_to_win = float(points_to_win) / points_per_agenda
    if int(num_scored_to_win) == num_scored_to_win:
        return int(num_scored_to_win)
    return round(num_scored_to_win, 2)
コード例 #3
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def average_actions_to_score_winning_agendas(cards, identity=None, **kwargs):
    points_to_win = 7
    if identity.name == "Harmony Medtech: Biomedical Pioneer":
        points_to_win = 6
    agendas = data.get_cards_of_type('agenda', cards)
    print '^'*20
    for card in agendas:
        print card.name, card.actions, card.agendapoints
    print '^'*20
    num_agendas = data.get_total_cards(agendas)
    total_actions = data.sum_over_attr('actions', agendas, convert_type=int)
    total_points = data.sum_over_attr('agendapoints', agendas, convert_type=int)
    ratio = points_to_win / float(total_points)
    #actions_per_agenda = float(total_actions) / num_agendas
    average_actions_to_score = float(total_actions) * ratio
    if average_actions_to_score == int(average_actions_to_score):
        return int(average_actions_to_score)
    return round(average_actions_to_score, 2)
コード例 #4
0
def average_actions_to_score_winning_agendas(cards, identity=None, **kwargs):
    points_to_win = 7
    if identity.name == "Harmony Medtech: Biomedical Pioneer":
        points_to_win = 6
    agendas = data.get_cards_of_type('agenda', cards)
    print '^' * 20
    for card in agendas:
        print card.name, card.actions, card.agendapoints
    print '^' * 20
    num_agendas = data.get_total_cards(agendas)
    total_actions = data.sum_over_attr('actions', agendas, convert_type=int)
    total_points = data.sum_over_attr('agendapoints',
                                      agendas,
                                      convert_type=int)
    ratio = points_to_win / float(total_points)
    #actions_per_agenda = float(total_actions) / num_agendas
    average_actions_to_score = float(total_actions) * ratio
    if average_actions_to_score == int(average_actions_to_score):
        return int(average_actions_to_score)
    return round(average_actions_to_score, 2)
コード例 #5
0
def upgrade(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('upgrade', cards))
コード例 #6
0
def asset(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('asset', cards))
コード例 #7
0
def agenda(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('agenda', cards))
コード例 #8
0
def draw_rate_of_income_cards(cards, full_deck=None, **kwargs):
    num_cards = data.get_total_cards(full_deck)
    income_cards = data.get_money_making_cards(cards)
    num_income_cards = data.get_total_cards(income_cards)
    ratio = num_income_cards / float(num_cards)
    return get_percent_from_decimal(ratio)
コード例 #9
0
def number_of_ice_that_ends_runs(cards, **kwargs):
    ice = data.get_ice(cards)
    end_run_ice = data.advanced_deck_search(ice, exact_text=["end the run"])
    return data.get_total_cards(end_run_ice)
コード例 #10
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def total_as_ratio(cards, **kwargs):
    deck = kwargs['full_deck']
    set_total = data.get_total_cards(cards)
    total = deck.total_cards
    ratio = float(set_total) / float(total)
    return get_percent_from_decimal(ratio)
コード例 #11
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def agenda(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('agenda', cards))
コード例 #12
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def average_net_income_from_instant_cards(cards, **kwargs):
    cards = data.get_money_making_cards(cards)
    total_income = data.get_net_income_from_cards(cards, instant=True)
    num_income_cards = data.get_total_cards(cards)
    return round(float(total_income) / num_income_cards, 2)
コード例 #13
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def draw_rate_of_income_cards(cards, full_deck=None, **kwargs):
    num_cards = data.get_total_cards(full_deck)
    income_cards = data.get_money_making_cards(cards)
    num_income_cards = data.get_total_cards(income_cards)
    ratio = num_income_cards / float(num_cards)
    return get_percent_from_decimal(ratio)
コード例 #14
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def net_income_draw_rate(cards, full_deck=None, **kwargs):
    income_cards = data.get_money_making_cards(cards, instant=True)
    total_net_income = data.sum_over_attr('net_income', income_cards)
    total_cards = data.get_total_cards(full_deck)
    net_income_draw_rate = float(total_net_income) / total_cards
    return round(net_income_draw_rate, 2)
コード例 #15
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def number_of_ice_that_ends_runs(cards, **kwargs):
    ice = data.get_ice(cards)
    end_run_ice = data.advanced_deck_search(ice, exact_text=["end the run"])
    return data.get_total_cards(end_run_ice)
コード例 #16
0
def icebreaker(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_subtype('icebreaker', cards))
コード例 #17
0
def hardware(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('hardware', cards))
コード例 #18
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def ice(cards, **kwargs):
    return data.get_total_cards(data.get_ice(cards))
コード例 #19
0
def total_as_ratio(cards, **kwargs):
    deck = kwargs['full_deck']
    set_total = data.get_total_cards(cards)
    total = deck.total_cards
    ratio = float(set_total) / float(total)
    return get_percent_from_decimal(ratio)
コード例 #20
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def asset(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('asset', cards))
コード例 #21
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def operation(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('operation', cards))
コード例 #22
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def upgrade(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('upgrade', cards))
コード例 #23
0
def net_income_draw_rate(cards, full_deck=None, **kwargs):
    income_cards = data.get_money_making_cards(cards, instant=True)
    total_net_income = data.sum_over_attr('net_income', income_cards)
    total_cards = data.get_total_cards(full_deck)
    net_income_draw_rate = float(total_net_income) / total_cards
    return round(net_income_draw_rate, 2)
コード例 #24
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def event(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('event', cards))
コード例 #25
0
def average_net_income_from_instant_cards(cards, **kwargs):
    cards = data.get_money_making_cards(cards)
    total_income = data.get_net_income_from_cards(cards, instant=True)
    num_income_cards = data.get_total_cards(cards)
    return round(float(total_income) / num_income_cards, 2)
コード例 #26
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def icebreaker(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_subtype('icebreaker', cards))
コード例 #27
0
def ice(cards, **kwargs):
    return data.get_total_cards(data.get_ice(cards))
コード例 #28
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def program(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('program', cards))
コード例 #29
0
def operation(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('operation', cards))
コード例 #30
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def hardware(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('hardware', cards))
コード例 #31
0
def event(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('event', cards))
コード例 #32
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def resource(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('resource', cards))
コード例 #33
0
def program(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('program', cards))
コード例 #34
0
def total_cards(cards, **kwargs):
    return data.get_total_cards(cards)
コード例 #35
0
def resource(cards, **kwargs):
    return data.get_total_cards(data.get_cards_of_type('resource', cards))
コード例 #36
0
ファイル: analyze.py プロジェクト: danielmoniz/netrunner_db
def total_cards(cards, **kwargs):
    return data.get_total_cards(cards)