Skip to content

Commit 1d575e2

Browse files
committed
Adding docs.
1 parent 2b14c9f commit 1d575e2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/tutorials/advanced/strategy_transformers.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,23 @@ after two consequtive rounds of `(D, C)`::
132132
>>> from axelrod.strategy_transformers import TrackHistoryTransformer
133133
>>> player = TrackHistoryTransformer(axelrod.Random)()
134134

135+
* :code:`MutateTransformer`: Randomly plays a mutation to another strategy (or
136+
set of strategies. Here is the syntax to do this with a set of strategies::
137+
138+
>>> import axelrod
139+
>>> from axelrod.strategy_transformers import MutateTransformer
140+
>>> strategies = [axelrod.Grudger, axelrod.TitForTat]
141+
>>> probability = [.2, .3] # .5 chance of mutated to one of above
142+
>>> player = MutateTransformer(probability, strategies)(axelrod.Cooperator)
143+
144+
Here is the syntax when passing a single strategy::
145+
146+
>>> import axelrod
147+
>>> from axelrod.strategy_transformers import MutateTransformer
148+
>>> strategy = axelrod.Grudger
149+
>>> probability = .2
150+
>>> player = MutateTransformer(probability, strategy)(axelrod.Cooperator)
151+
135152

136153
Composing Transformers
137154
----------------------

0 commit comments

Comments
 (0)