-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desired New strategies #379
Comments
This is a brilliant issue: 👍 |
This strategy was mentioned on reddit (Random TitForTat and/or Grudger: defects with random probability): https://www.reddit.com/r/GAMETHEORY/comments/480xb3/how_to_beat_this_strategy_of_prisoners_dilemma/ |
Would you mind if I started working on a few of these? I'm sure I'll be slow since I'm new to programming and I'm going to school while working full time, but it looks like they've been posted for awhile. If there are any strategies on the list that are particularly easy to implement I'd be happy to start with one of those. |
Absolutely @Adam-Flammino: please do! I suggest that when you decide on a strategy you run it past us just to make sure it hasn't been implemented yet (it's possible that they're on the list but have already been implemented). It could also be worth checking here: http://axelrod.readthedocs.io/en/latest/reference/all_strategies.html That's the list of the strategies that are definitely in the library :) As far as a suggestion for an initial one to go for, perhaps pick "Nasty Tit For Tat" which is described as "tit-for-tat but attempts to exploit non-retaliatory strategies by playing a DD with some probability". If you think there's another one in the list that you like the look of please do go for that though :) Also: if you need help you can always pop in to this chat room https://gitter.im/Axelrod-Python/Axelrod there are usually a few of us around that can help :) |
That actually sounds a little similar to how I play risk. I've definitely got some more reading to do before I start, but I'd be happy to try. Thanks for the chat link too! |
@Adam-Flammino We're happy to e.g. help write tests, just open a PR or ask us here (or on gitter). |
@marcharper thanks! Haven't gotten to start yet, but I appreciate the help! Hopefully before too long I'll be able to actually help out with the project- it looks interesting |
So I got to actually sit down and look at things today. I appreciate all the variations of tit for tat being in the same .py file- makes it easier for someone who's still learning like me to see the right format. Another quick newb question- should I submit a new .py file with my pull request or just add my code to the end of the existing file? |
@Adam-Flammino Either way, really. We don't have a scheme for which strategies go in which files, we just group them as we go wherever they seem to fit. |
@marcharper Cool. Thanks again. |
If you're going to go with nasty tit for that as the strategy I'd suggest that you just add that to the bottom of the existing tit for tat file:) |
I appreciate how welcoming you all have been and I do think this is a very interesting project I'd like to help with eventually, but some life changes just came up and I don't know when I'll have time to actually contribute to this. I plan on coming back (hopefully with enough experience to make real contributions), but I'm not sure when that will be so don't hold any of these for me. |
@Adam-Flammino No problem - thanks for the contributions so far! We'll still be here when you have time again. All the best. |
I would like to help in writing some of the strategies. |
@souravsingh Are you here at PyCon UK? |
@meatballs I couldn't come to PyCon UK due to visa issues. But I can try and help remotely. |
Welcome @souravsingh! Drop in to our gitter channel: gitter.im/Axelrod-Python/Axelrod Otherwise, take a look at the contribution guidelines and don't hesitate to ask any questions :) http://axelrod.readthedocs.io/en/latest/tutorials/contributing/strategy/index.html |
Hi. Is soft_tf2t up for grabs? |
@mturzanska I'm afraid that that's in already to under (Please correct me if you think I'm not quite right reading the two logics). |
You're right. Then continuing from the top:
Please let me know if I sorted it out right this time. |
That would be awesome! Let us know if we can assist in any way :) 👍 |
Thank you for your answer. Thank you |
Hi @MariosZoulias -- the strategy isn't well-described but I assume that the Chi-squared test is used to determine if the opponent is playing randomly by some level of confidence, and if so, defect against it. |
Thanks a lot for the answer.
Thank you |
I believe it's a straight forward chi squared test based on the two numbers: the number of cooperations and the number of defections. A chi squared test checks those counts and infers (from the total number of counts) whether or not this is a random distribution.
No Alternator, Cooperater and Defector are not random. If you were playing against Cooperator the count of cooperations after 40 turns would be 40 cooperations and 0 defections. That would be statistically different to 20 cooperations and 20 defections as would be indicated by the chi squared test. If you were playing the Random player, perhaps after 4 turns you would have 4 cooperations and 0 defetcions and (perhaps) the chi squared test would say that that is statistically different to random behaviour however after 40 rounds maybe the count would be 24 and 16 which the chi squared test would say is random. Here is the chi-squared test in scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chisquare.html >>> from scipy.stats import chisquare
>>> test = chisquare([4, 0])
>>> test.pvalue
0.04550026389635857
>>> test = chisquare([26, 16])
>>> test.pvalue
0.12282264810139186
>>> test = chisquare([40, 40])
>>> test.pvalue
1.0
>>> test = chisquare([101, 99])
>>> test.pvalue
0.88753708398171505 Here is a plot of
That's showing that the What a chi squared test is doing is checking if the distribution given (the count of defections and cooperations) is statistically significant to the random distribution (50/50 split). This is done by comparing the |
Note that >>> from scipy.stats import chisquare
>>> import axelrod as axl
>>> axl.seed(0)
>>> players = (axl.Cooperator(), axl.Random())
>>> match = axl.Match(players, turns=200)
>>> _ = match.play()
>>> players[0].cooperations, players[0].defections
(200, 0)
>>> chisquare([players[0].cooperations, players[0].defections]).pvalue
2.0884875837625688e-45
>>> players[1].cooperations, players[1].defections
(93, 107)
>>> chisquare([players[1].cooperations, players[1].defections]).pvalue
0.32219880616257868 |
Thank you for the analysis .
What do i think wrong here? |
You're not doing anything wrong, I think you're just pointing out a weakness of the strategy. From how it is described I think the only thing you can do is test the distribution of C and D as I have written. Because of the way the strategy in question plays it would in fact recognise that Tit for Tat is not random. |
Some simple ZD ones to implement from the literature. From @marcharper on #1041:
|
Have edited the above list with a pointer to the fortran strategies. |
@drvinceknight The link to Mensa strategy shows a license which says that- "Redistributions of source code must retain the above copyright Should we be working on adding the strategies to the library, considering the license is incompatible? |
The licence applies to the source code itself - not to the idea which is captured by that code. We would be in breach of the licence if we took the code and incorporated into our library, but we are perfectly ok to take code the strategy ourselves. |
Hello all! What a cool project, I just discovered this a few days ago. I'd love to contribute some new strategies. Has anyone implemented a Perlin style random strategy? |
Hi @JCodyA, you can check the list of references in the documentation to see if there's a matching source. If you are still unsure, please post a source and I should be able to tell if there's already a matching strategy in the library. |
@marcharper I had a look at docs/reference/all_strategies.rst and the only strategy listed that was similar was the rand.py strategy, but not a perlin one. I'm thinking of two possible variations of a perlin strategy: a perlin cooperator and a perlin defector. One will cooperate on a semi random basic similar to natural randomness (ie raindrops), and the other will defect on a semi random basis. |
@JCodyA I don't think there's anything quite like that -- I presume you mean that a player will say defect with some distribution other than a Bernoulli. There are several strategies that behave like say TFT and then randomly defector or otherwise act randomly or noisily, but that doesn't sound like quite the same thing. See TrickyCooperator and RandomTitForTat for examples. |
Some of these may be implemented under other names already, please ask if you are unsure! Feel free to add any new ones to the list. Note that we are happy to have original contributions as well!
for the Iterated Prisoner’s Dilemma
The "invincible strategies" in this paper which can all be implemented as special cases of the MemoryOne or LRPlayer classes.
The two "most abundant" memory one and memory two strategies in this paper.
Adaptor from Simple Adaptive Strategy Wins the Prisoner’s Dilemma second_pdf
Specific strategies evolved in Evolutionary game theory using agent-based methods such as GCA.
Strategy MO and Strategy SO from this paper
Strategies implemented in PRISON (look in
classics.str
):slow_tftbetter_and_betterworse_and_worse2,worse_and_worse3and see this paper
winner12winner 21mem2gradual_killer [Already done on another name?]c_then_per_dc,doubler,easy_go,gradual,per_ddc,per_cccdcd,prober4,tft_spiteful,worse_and_worseFrom CoopSim:
ContriteTFTMany strategies in this paper are not yet in the library:
From "Exploiting Evolutionary Modeling to Prevail in Iterated Prisoner’s Dilemma Tournaments":
From this page (see also the bibliography) for the 20th anniversary tournament:
Soft GrudgerAdaptive Tit For TatAdaptiveAPavlov: http://www.graham-kendall.com/papers/lhk2011.pdfNEG: "NEG plays according to simple rules: if opponent plays COOPERATION, in next move NEG will play DEFECTION; if opponent plays DEFECTION NEG will play COOPERATION. First move will be random."Omega Tit For Tat(see also here)From here:
From this paper and also here:
adaptive tftcontrite tfthandshakefortress3fortress4firm but fairgradualnaive proberremorseful proberreverse pavlovsoft grudgerAny of the interesting finite state machine strategies in the papers with fortress (and other papers authored by Wendy Ashlock and Daniel Ashlock, and collaborators)
Prisoner’s Dilemma Playing Agents" including the unnamed sugar strategies and treasure hunt strategies in figures 2 and 3
Solution B1andSolution B5Also from "Fingerprint Analysis of the Noisy Prisoner's Dilemma Using a Finite-State Representation"
Many from this paper. Note the several are already in the library, including
ALLC, ALLD, TFT, WSLS, willing, hopeless, and desperate(and possibly others).From these two papers:
From this page:
From the mythical tournament preliminary to Axelrod #1:
From this publication:
GradualAdaptive tit-for-tatFrom this paper:
From this paper:
shortmemselfsteemVeryBadStalkerFrom this library (if the license is compatible):
Others:
DBS, DesiredBeliefStrategy refNo-tricks
Strategies described here
Theory of mind strategies discussed here.
Would be neat to have strategies based on:
finite state machinese.g.Translate Fortran strategies available in https://github.com/Axelrod-Python/axelrod-fortan to python.
The text was updated successfully, but these errors were encountered: