def test_proper_detective_beats_incomplete_detective(): _, _, games = new_game(2, 18, 1, 0) idwd = mafia.eval_strat_rc(games, incomplete_detective) pdwd = mafia.eval_strat_rc(games, proper_detective) imw, icw = mafia.winner_probabilities(games, idwd) pmw, pcw = mafia.winner_probabilities(games, pdwd) # proper detective wins more often assert pcw > icw
def test_incomplete_detective_same_as_no_detective(): _, _, games = new_game(2, 19, 0, 0) gwd = mafia.eval_strat_rc(games, original_strat) _, _, dgames = new_game(2, 18, 1, 0) dwd = mafia.eval_strat_rc(dgames, incomplete_detective) assert mafia.winner_probabilities(games, gwd) == mafia.winner_probabilities( dgames, dwd)
def example_with_proper_detective(): pl, gs, games = new_game(2, 18, 1, 0) weight_dict = mafia.eval_strat_rc(games, proper_detective) mafia_win, citizen_win = mafia.winner_probabilities(games, weight_dict) # ~0.3587 0.6413 (after capabilities 1&2, did and should make citizen stronger) # ~0.343 0.657 (after capability 3&4, did and should make citizens stronger) # ~0.3902 0.6098 (after capability 5&6, did and should make mafia stronger) # note the above dont mean a lot because capability 7 # was kind of important # ~0.3595 0.6405 (after capability 7, did and should make citizens stronger) print("Proper:", frac_to_pct(mafia_win), frac_to_pct(citizen_win))
def example_with_incomplete_detective(): pl, gs, games = new_game(2, 18, 1, 0) weight_dict = mafia.eval_strat_rc(games, incomplete_detective) mafia_win, citizen_win = mafia.winner_probabilities(games, weight_dict) # ~0.4929 0.5071 print("Incomplete", frac_to_pct(mafia_win), frac_to_pct(citizen_win))
def original_game(): pl, gs, games = new_game(2, 19, 0, 0) weight_dict = mafia.eval_strat_rc(games, original_strat) return pl, gs, games, weight_dict
def test_can_play_proper_detective(): pl, gs, games = new_game(2, 18, 1, 0) weight_dict = mafia.eval_strat_rc(games, proper_detective) mafia_win, citizen_win = mafia.winner_probabilities(games, weight_dict) assert mafia_win + citizen_win == 1
def test_incomplete_detective_original_strat_same(): pl, gs, games = new_game(2, 19, 0, 0) weight_dict_original = mafia.eval_strat_rc(games, original_strat) weight_dict_simple = mafia.eval_strat_rc(games, incomplete_detective) assert weight_dict_original == weight_dict_simple