axelrod-python / axelrod Goto Github PK
View Code? Open in Web Editor NEWA research tool for the Iterated Prisoner's Dilemma
Home Page: http://axelrod.readthedocs.org/
License: Other
A research tool for the Iterated Prisoner's Dilemma
Home Page: http://axelrod.readthedocs.org/
License: Other
Simple to do: will make plots look nicer.
mindreader and geller are 2 'cheater' strategies but they cannot actually play against each other.
Would be cool to figure it out (even if perhaps we do this with error handling...)
@JasYoung314
This really should have been in place from the start: tidies things up nicely.
Very easy PR:
run_tournament.py
scriptThey results objects make use of numpy
and matplotlib
.
This will then determine which tournament they should be run in (Cheating class, All class etc)
In other words should we try to avoid numpy
in the couple of places that we use it (it would be relatively straightforward to remove it as a dependancy)?
(matplotlib
is another kettle of fish as there is no alternative)
Is this something that you can even do?
Need to add code to bottom of every test script... (Why did I not do this to start?)
if __name__ == '__main__':
unittest.main()
Not sure if this is the right place for this, if not, please say!
I've been reading a bit around the history of this, and found a document which claims that the original tournament had 14 entries (15 including random) and the follow up had 62 entries (63 including random). These 62/63 strategies then went into the ecological tournament.
So whilst the number of strategies is not yet close to the number in the second iteration of the original tournament, we have nearly double the number used in the first iteration.
My questions:
It must be possible to automate the generation of a sub header etc for each strategy?
Currently in the strategies.rst
file I have manually listed all of them. I can't seem to be able to find how to automate this...
(Here's the currently rendered documentation: http://axelrod.readthedocs.org/en/latest/)
All files are written using sphinx in rst and can be found in the docs
directory.
My apologies if I'm missing something, but aren't the 'Fool Me Once' and 'Grudger' strategies the same strategy with different implementations in code?
Based on hitchhikers guide this is apparently needed for Pypi.
Even if it's just a simple one liner that basically repeats the name of the function itself.
Note that read the docs can render mathjax etc...
(Here's the currently rendered documentation: http://axelrod.readthedocs.org/en/latest/)
All files are written using sphinx in rst and can be found in the docs
directory.
I'm not sure if it was organized by Axelrod, but there was a subsequent "ecological" tournament where each strategy was represented by some number of copies. The tournament consisted of ~1000 generations, and at the beginning of each generation the population of a strategy was set based on its score in the previous round.
This interesting variant could be easily built on top of the current code.
and invite people to add their name/url when they contribute...
Could use this as an opportunity to try out readthedocs...
Replace the current bespoke logging solution with the standard logging package: https://docs.python.org/2/library/logging.html
Depends on #116
Following discussion here #98 I'd like to include a try... except
for the use of matplotlib.
I think that this might be able to be incorporated in to the work being done by @meatballs on #88 (Owen, I'd be happy to accept a PR without the error handling and put that in myself).
Have players have a reset
method and just replace the relevant reset methods in the tournament.
Implement the strategy design pattern described here: https://en.wikipedia.org/wiki/Strategy_pattern
This would:
Both a function and a class based example of how the pattern might be implemented in Python are described here: http://codereview.stackexchange.com/questions/20718/strategy-design-pattern-with-various-duck-type-classes
So there is now a packaged version of axelrod
available via pip
. This is all from the packaging
branch and this issue is to discuss any issues before merging in to master and making things 'official' :)
To test, I suggest creating a virtualenv as this will install 'system wide':
virtualenv tmp-axelrod2 # I had about 7 of these going as I as testing and am just about to tear them down
cd tmp-axelrod2 #ย Go to that directory
source bin/activate # (depending on your shell this might need a tweak)
Type the following just to make sure that you have got a virtualenv:
which pip
Install through the magics of the internetz:
pip install axelrod
Note that that pulls down matplotlib
also (which if you're in the virtualenv you will notice).
Now to run the tournament I have made some tweaks (see the packaging
branch).
Firstly I've renamed the run_tournament.py
script to run_axelrod
as pip
now installs this as an executable file system wide.
So below will run the very basic tournament:
run_axelrod --xs --xc --xa --ne
One thing that will need work on this branch before pulling in to master
will be updating the documentation.
The documentation could perhaps use a nice favicon and image?
If anyone's good with design etc... Perhaps throw some images in this issue?
(Here's the currently rendered documentation: http://axelrod.readthedocs.org/en/latest/)
All files are written using sphinx in rst and can be found in the docs
directory.
This commit: 427c4fe
I'd like every strategy to be extensively tested. Some don't have tests for basic methods (repr
etc...), whilst this might seem like overkill, I would prefer this project to be over tested than under tested.
This is currently an empty rst
file. Would be nice to come up with a nice guide (similar but improved version of what is currently in the README) and also include guidelines about convention (similar to discussion had at #85.
(Here's the currently rendered documentation: http://axelrod.readthedocs.org/en/latest/)
All files are written using sphinx in rst and can be found in the docs
directory.
This class should handle the production of a matlibplot boxplot based on a ResultSet instance passed to its init method.
The functions to generate the boxes/whiskers, xticks, and title should be separate methods with tests for each.
The method which would return an instance of matlibplot.Figure probably cannot be tested as Travis does not have matlibplot installed.
run_tournament.py would handle the creation of .png files based on the Figure object returned from this class.
@marcharper wrote a big pull request that took me a little while to merge as it needed tests etc...
I ended up commenting out two of the strategies: fa57959
It would be great to get them in, it just needs some tests and a PR that clarifies a couple of things.
Looking at the boxplot it seems the the random strategy gets a score higher than it should be able to.
So I've just written what I feel is an ok first draft of the documentation: http://axelrod.readthedocs.org/en/latest/ (by the way, what is the favicon for you on that? It seems to not at all be what I had hoped...).
I really want to get it so that this package can be installed as so:
pip install axelrod
To do this I need to write a setup.py file (working on #94 as we speak, using: https://the-hitchhikers-guide-to-packaging.readthedocs.org/en/latest/).
Does anyone know anything about this sort of thing/had an experience with it (so I'd like to tag this as a 0.1 version for example)? If you do, any tips/pointers etc would be awesome :)
@JasYoung314
By including games with non zero scores
Add a variant where each round ends the match with given probability.
What happens when a geller encounters another geller?
Possibly write a full tournament
method.
Simply need to check that the tournament runs.
As the number of strategies grows: the mathces (or just the random repetitions) can be parallelised (possibly even making use of caching for non stochastic strategies...).
I'd suggest:
matplotlib
for example is deemed necessary but has exception handling so that code can be run without it).As far as I can tell this is something to do with #122 but I have no idea.
It hangs at this stage:
โ Axelrod git:(master) โ python run_tournament.py -p 3
Starting basic_strategies tournament with 10 round robins of 200 turns per pair.
Passing cache with 0 entries to basic_strategies tournament
Running repetitions with 3 parallel processes
Finished basic_strategies tournament in 0.0s
Starting ecological variant of basic_strategies
Finished ecological variant of basic_strategies in 0.0s
Cache now has 10 entries
Finished all basic_strategies tasks in 1.3s
Starting strategies tournament with 10 round robins of 200 turns per pair.
Passing cache with 10 entries to strategies tournament
Running repetitions with 3 parallel processes
To speed up the running of the tournament it would be nice to add the option to parallelise the various matches (or indeed more simply the repetitions).
This could then be run by using a command line argument...
I'm pretty sure I've never parallelised anything 'in the right way' so I'm throwing the help wanted label on this one... If you'd like to pick it up: let's chat :)
This could be turned into a Django application, hosted on Heroku or similar, with the tournament(s) results serialised to JSON via the Django Rest Framework and therefore available publicly for analysis by anyone.
There could be an admin backend for configuring and initialising tournaments and some work in AngularJS and D3 should enable all sorts of visualisiation.
Depends on: #45
Just have to find someone to fund my time to do this rather than the day job!!
Rename and extend the BoxPlot class so that it also processes the payoff plots thus:
If we use docopt we should grab the script directly and not require it to be installed, because this is so simple though we could just use the base python argv or there is some python inbuilt library also...
Perhaps there is a way to script pulling the description of the strategy out of docstring... I know that sage does this, that could work in conjunction with readthedocs...
I set this up last weekend: http://axelrod.readthedocs.org/en/docs/ it is reading off the docs
branch which has nothing in it.
See this branch/commit: 63eaa85
@geraintpalmer @JasYoung314
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.