Exemple #1
0
    def test_expectimax_tanner() -> None:
        """Correctly play one round of one night werewolf."""
        const.NUM_PLAYERS = 9
        const.NUM_CENTER = 3
        const.EXPECTIMAX_TANNER = True
        const.RANDOMIZE_ROLES = False
        set_roles(
            Role.INSOMNIAC,
            Role.HUNTER,
            Role.MASON,
            Role.MASON,
            Role.ROBBER,
            Role.SEER,
            Role.TANNER,
            Role.TROUBLEMAKER,
            Role.VILLAGER,
            Role.VILLAGER,
            Role.VILLAGER,
            Role.WOLF,
        )

        stat_tracker = one_night.simulate_game(num_games=20)

        stat_results = stat_tracker.get_metric_results()
        write_results(stat_results, "standard/expectimax_tanner.csv")
        assert stat_results["tanner_wins"] > 0.8
Exemple #2
0
    def test_random_wolf(standard_game_roles: tuple[Role, ...]) -> None:
        """Correctly play one round of one night werewolf."""
        stat_tracker = one_night.simulate_game(num_games=1000)

        stat_results = stat_tracker.get_metric_results()
        write_results(stat_results, "standard/random_wolf.csv")
        assert stat_results["villager_wins"] > 0.8
        assert stat_results["tanner_wins"] == 0
        assert stat_results["werewolf_wins"] < 0.2
    def test_reg_wolf(standard_game_roles: tuple[Role, ...]) -> None:
        """Correctly play one round of one night werewolf."""
        const.MULTI_STATEMENT = True
        const.USE_REG_WOLF = True

        stat_tracker = one_night.simulate_game(num_games=1000)

        stat_results = stat_tracker.get_metric_results()
        write_results(stat_results, "multistatement/reg_wolf.csv")
        assert stat_results["villager_wins"] < 0.51
        assert stat_results["tanner_wins"] == 0
        assert stat_results["werewolf_wins"] > 0.49
Exemple #4
0
    def test_expectimax_wolf(standard_game_roles: tuple[Role, ...]) -> None:
        """Correctly play one round of one night werewolf."""
        const.USE_REG_WOLF = True
        const.EXPECTIMAX_WOLF = True

        stat_tracker = one_night.simulate_game(num_games=500)

        stat_results = stat_tracker.get_metric_results()
        write_results(stat_results, "standard/expectimax_wolf.csv")
        assert stat_results["villager_wins"] < 0.6
        assert stat_results["tanner_wins"] == 0
        assert stat_results["werewolf_wins"] > 0.4