Beispiel #1
0
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
Beispiel #2
0
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)
Beispiel #3
0
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))
Beispiel #4
0
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))
Beispiel #5
0
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
Beispiel #6
0
def test_winner_probabilities():
    pl, gs, games, weight_dict = original_game()
    mafia_win, citizen_win = mafia.winner_probabilities(games, weight_dict)
    assert mafia_win == Fraction(478099, 969969)
    assert citizen_win == Fraction(491870, 969969)