Adding the new strategyΒΆ
To get the strategy to be recognised by the library we need to add it to the
files that initialise when someone types import axelrod
. This is done
in the axelrod/strategies/_strategies.py
file.
To classify the new strategy, run rebuild_classifier_table:
python rebuild_classifier_table.py
This will update axelrod/strategies/_strategies.py
. Check that the
recorded classifications for the strategies are what you expected.
If you have added your strategy to a file that already existed (perhaps you
added a new variant of titfortat
to the titfortat.py
file),
simply add your strategy to the list of strategies already imported from
<file_name>.py
:
from <file_name> import <list-of-strategies>
If you have added your strategy to a new file then simply add a line similar to above with your new strategy.
Once you have done that, you need to add the class itself to the
all_strategies
list (in axelrod/strategies/_strategies.py
).
You will also need to increment the doctest in
axelrod/docs/index.rst
.
Finally, if you have created a new module (a new <strategy.py>
file)
please add it to the docs/references/all_strategies.rst
file so that it
will automatically be documented.