def sp_strategies():
    """The list of strategies used in Stewart and Plotkin's 2012 tournament."""

    strategies = [
        axelrod.Cooperator(),  # ALLC
        axelrod.Defector(),  # ALLD
        axelrod.GTFT(),
        axelrod.GoByMajority(soft=False),  # HARD_MAJO
        #axelrod.GoByMajority(soft=True), # SOFT_MAJO
        axelrod.TitFor2Tats(),  # TFT2
        axelrod.HardTitFor2Tats(),  # HARD_TFT2
        axelrod.Random(),  # RANDOM
        axelrod.WinStayLoseShift(),  # WSLS
        axelrod.TitForTat(),
        axelrod.HardTitForTat(),  # HARD_TFT
        axelrod.Grudger(),  # GRIM
        axelrod.Joss(),  # HARD_JOSS
        axelrod.ZDGTFT2(),
        axelrod.ZDExtort2(),
        axelrod.Prober(),
        axelrod.Prober2(),
        axelrod.Prober3(),
        axelrod.HardProber(),
        axelrod.Calculator(),
    ]
    return strategies
Exemplo n.º 2
0
 def test_rounds(self):
     self.versus_test(
         axl.ZDExtort2(),
         axl.TitForTat(),
         [C, D, C, D, D, D],
         [C, C, D, C, D, D],
         seed=100,
     )
Exemplo n.º 3
0
 def test_rounds(self):
     self.versus_test(
         axelrod.ZDExtort2(),
         axelrod.TitForTat(),
         [C, D, D, D, D, D],
         [C, C, D, D, D, D],
         seed=2,
     )
Exemplo n.º 4
0
def main():
    player = axl.ZDExtort2()
    opponent = axl.Alternator()
    axl.seed(0)
    match = axl.Match(players=(player, opponent), turns=20)
    interactions = match.play()
    df = pd.DataFrame(interactions,
                      columns=["(8/9, 1/2, 1/3, 0)", "Alternator"])
    df["Turn"] = df.index + 1
    df = df[["Turn", "(8/9, 1/2, 1/3, 0)", "Alternator"]]
    df = df.transpose()
    string = df.to_latex(header=False).replace("\\\\", "\\\\\\midrule", 1)
    with open("main.tex", "w") as f:
        f.write(string)
Exemplo n.º 5
0
def main():
    strategies = [
        axelrod.Cooperator(),
        axelrod.Defector(),
        axelrod.Random(0.4),
        axelrod.Random(0.5),
        axelrod.Random(0.9),
        axelrod.Alternator(),
        axelrod.TitForTat(),
        axelrod.GTFT(),
        axelrod.WinStayLoseShift(),
        axelrod.ZDGTFT2(),
        axelrod.ZDExtort2(),
        axelrod.TitFor2Tats(),
        axelrod.TwoTitsForTat(),
        axelrod.CyclerCCD(),
        axelrod.CyclerCCCD(),
        axelrod.CyclerCCCCCD(),
        axelrod.HardTitForTat(),
        axelrod.AntiCycler(),
        axelrod.Grudger()
    ]

    for opponent in strategies:
        data_dict, test_results, estimate = infer_depth(opponent)

        print opponent
        print "-" * len(str(opponent))
        print "Collected Data"
        print_dict(data_dict)
        C_count = sum(v[0] for (k, v) in data_dict.items())
        D_count = sum(v[1] for (k, v) in data_dict.items())
        print "C count, D count: %s, %s" % (C_count, D_count)
        print "\nFisher Exact Tests"
        print_dict(test_results)
        print "\nEstimated Memory One Probabilities"
        print_dict(estimate)
        print
Exemplo n.º 6
0
    axl.Leyvraz(),
    axl.Mikkelson(),
    axl.MoreGrofman(),
    axl.MoreTidemanAndChieruzzi(),
    axl.RichardHufford(),
    axl.Tester(),
    axl.Tranquilizer(),
    axl.Weiner(),
    axl.White(),
    axl.WmAdams(),
    axl.Yamachi()
]

# The list of agents playing in the Stewart-Plotkin's tournament.
steward_plotkin_players = [
    axl.ZDExtort2(),
    axl.HardGoByMajority(),
    axl.HardTitForTat(),
    axl.HardTitFor2Tats(),
    axl.GTFT(),
    axl.ZDGTFT2(),
    axl.Calculator(),
    axl.Prober(),
    axl.Prober2(),
    axl.Prober3(),
    axl.HardProber(),
    axl.NaiveProber()
]

# The list of agents playing in the Case's simulation
case_players = [
Exemplo n.º 7
0

if __name__ == "__main__":

    outcomes_file = "../data/outcomes.csv"
    output_file = "../data/fixation_validation.csv"
    with open(output_file, "w") as f:
        f.write("Repetitions,N,i,Player 1,Player 2,Theoretic,Simulated\n")

    player_pairs = [(axl.Defector(), axl.Defector()),
                    (axl.Defector(), axl.Alternator()),
                    (axl.Defector(), axl.Cooperator()),
                    (axl.Defector(), axl.TitForTat()),
                    (axl.Defector(), axl.WinStayLoseShift()),
                    (axl.Random(), axl.Random()),
                    (axl.Random(), axl.ZDExtort2()),
                    (axl.Random(), axl.GTFT()),
                    (axl.Random(), axl.ALLCorALLD()),
                    (axl.Random(), axl.PSOGambler2_2_2()),
                    (axl.Cooperator(), axl.Random()),
                    (axl.Cooperator(), axl.ZDExtort2()),
                    (axl.Cooperator(), axl.GTFT()),
                    (axl.Cooperator(), axl.ALLCorALLD()),
                    (axl.Cooperator(), axl.PSOGambler2_2_2()),
                    (axl.Alternator(), axl.Random()),
                    (axl.Alternator(), axl.ZDExtort2()),
                    (axl.Alternator(), axl.GTFT()),
                    (axl.Alternator(), axl.ALLCorALLD()),
                    (axl.Alternator(), axl.PSOGambler2_2_2()),
                    (axl.ALLCorALLD(), axl.Cooperator()),
                    (axl.ALLCorALLD(), axl.Defector()),