def test_solve_superwild_wedge_vs_wedge(): # noqa: D103 state = GameState.new() flag: Flag = state.get_flags()[0] flag.add_stack(PLAYER_A, CardGenerator.troop(TroopColors.RED, 9)) flag.add_stack(PLAYER_A, CardGenerator.tactic(TacticMorales.COMPANION_CAVALRY)) flag.add_stack(PLAYER_A, CardGenerator.tactic(TacticMorales.LEADER_ALEXANDER)) flag.add_stack(PLAYER_B, CardGenerator.troop(TroopColors.BLUE, 2)) flag.add_stack(PLAYER_B, CardGenerator.troop(TroopColors.BLUE, 3)) flag.add_stack(PLAYER_B, CardGenerator.troop(TroopColors.BLUE, 4)) assert _check_resolve(flag, state) == PLAYER_A
def test_solve_wedge_cavalry_and_wild(): # noqa: D103 stack = [ CardGenerator.tactic(TacticMorales.LEADER_ALEXANDER), CardGenerator.tactic(TacticMorales.COMPANION_CAVALRY), CardGenerator.troop(TroopColors.RED, 9), ] used_cards = [c for c in stack if isinstance(c, TroopCard)] strength, solved = possible_maximum_strength_for_wedge(stack, 3, used_cards) assert strength == sum([8, 9, 10]) assert solved
def test_flag_env_fog(): # noqa flag = Flag() assert not flag.is_formation_disabled() c_fog = CardGenerator.tactic(Tactics.FOG) flag.add_env(PLAYER_B, c_fog) assert len(flag.get_stacked_envs(PLAYER_B)) == 1 assert flag.is_formation_disabled()
def test_flag_env_mud(): # noqa flag = Flag() assert flag.get_required_card_num() == 3 c_mud = CardGenerator.tactic(Tactics.MUD) flag.add_env(PLAYER_A, c_mud) assert len(flag.get_stacked_envs(PLAYER_A)) == 1 assert flag.get_required_card_num() == 4
def test_flag_stack_tacticmorales(): # noqa flag = Flag() c_ld = CardGenerator.tactic(Tactics.LEADER_DARIUS) flag.add_stack(PLAYER_B, c_ld) assert len(flag.get_stacked_cards(PLAYER_B)) == 1 assert (flag.remove_stack_tacticmorales( PLAYER_B, TacticMorales.LEADER_DARIUS) == c_ld)
def test_solve_wild_wedge_vs_phalanx(): # noqa: D103 state = GameState.new() flag: Flag = state.get_flags()[0] flag.add_stack(PLAYER_A, CardGenerator.troop(TroopColors.RED, 3)) flag.add_stack(PLAYER_A, CardGenerator.troop(TroopColors.RED, 4)) flag.add_stack(PLAYER_A, CardGenerator.tactic(TacticMorales.LEADER_ALEXANDER)) flag.add_stack(PLAYER_B, CardGenerator.troop(TroopColors.BLUE, 8)) flag.add_stack(PLAYER_B, CardGenerator.troop(TroopColors.GREEN, 8)) flag.add_stack(PLAYER_B, CardGenerator.troop(TroopColors.YELLOW, 8)) assert _check_resolve(flag, state) == PLAYER_A
def test_solve_phalanx_wild(): # noqa: D103 stack = [ CardGenerator.troop(TroopColors.YELLOW, 9), CardGenerator.tactic(TacticMorales.LEADER_DARIUS), CardGenerator.troop(TroopColors.GREEN, 9), ] used_cards = [c for c in stack if isinstance(c, TroopCard)] strength, solved = possible_maximum_strength_for_phalanx(stack, 3, used_cards) assert strength == 9 * 3 assert solved
def test_solve_wedge_shield(): # noqa: D103 stack = [ CardGenerator.troop(TroopColors.RED, 3), CardGenerator.troop(TroopColors.RED, 4), CardGenerator.tactic(TacticMorales.SHIELD_BEARERS), ] used_cards = [c for c in stack if isinstance(c, TroopCard)] strength, solved = possible_maximum_strength_for_wedge(stack, 3, used_cards) assert strength == sum([2, 3, 4]) assert solved
def test_solve_wedge_wild(): # noqa: D103 stack = [ CardGenerator.troop(TroopColors.RED, 3), CardGenerator.troop(TroopColors.RED, 4), CardGenerator.tactic(TacticMorales.LEADER_ALEXANDER), ] used_cards = [c for c in stack if isinstance(c, TroopCard)] strength, solved = possible_maximum_strength_for_wedge(stack, 3, used_cards) assert strength == sum([3, 4, 5]) assert solved
def test_tactic_guile_card_repr_types(): # noqa for t in TacticGuiles: card = CardGenerator.tactic(t) assert repr(card)[1] == "G"
def test_tactic_env_card_repr_types(): # noqa for t in TacticEnvironments: card = CardGenerator.tactic(t) assert repr(card)[1] == "E"
def test_valid_tactic_card(): # noqa card = CardGenerator.tactic(Tactics.SCOUT) assert card.get_card_type() == CardType.TACTIC assert card.get_played_type() == PlayedCardType.GUILE_TACTICS assert card.get_tactics() == Tactics.SCOUT
def test_flag_deepcopy(): # noqa flag = Flag() c_r3 = CardGenerator.troop(TroopColors.RED, 3) flag.add_stack(PLAYER_A, c_r3) c_ld = CardGenerator.tactic(Tactics.LEADER_DARIUS) flag.add_stack(PLAYER_B, c_ld)