def test_two_0s(self):
        base_attack = 5
        atk_range = range(base_attack, base_attack + 1)
        deck = [cards.plus_0] * 2
        statistics_by_atk = deck_analyzer.derive_statistics(
            FrozenMultiset(deck), atk_range)

        self.assertEqual(5,
                         statistics_by_atk[base_attack].normal.expected_damage)
        self.assertEqual(
            5, statistics_by_atk[base_attack].advantage.expected_damage)
    def test_0_and_1(self):
        base_attack = 5
        atk_range = range(base_attack, base_attack + 1)
        deck = [cards.plus_0] + [cards.plus_1]
        statistics_by_atk = deck_analyzer.derive_statistics(
            FrozenMultiset(deck), atk_range)

        self.assertEqual(Fraction(5 + 6, 2),
                         statistics_by_atk[base_attack].normal.expected_damage)
        self.assertEqual(
            6, statistics_by_atk[base_attack].advantage.expected_damage)
Exemplo n.º 3
0
def main():
    atk_range = range(0, 4)
    decks_and_generation_methods = deck_generator.all_decks_and_generations_for(perk_sheets.three_spears)

    deck_count = len(decks_and_generation_methods)
    print("Decks to analyze: {}".format(deck_count))

    all_analysis = {}
    n = 0
    with SimpleTimerContext("Calculating all character decks."):
        for deck, generation_methods in decks_and_generation_methods.items():
            n += 1
            if n % 100 == 0:
                print(".", end="", flush=True)

            statistics_by_atk = deck_analyzer.derive_statistics(deck, atk_range)
            all_analysis[deck] = Analysis(statistics_by_atk, generation_methods)
        print("")

    maximum_damage_example(all_analysis)
    three_spears_refresh_item_example(all_analysis)

    print('Done!')