You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We see here that when we ran :code:`tournament.play()` it automatically repeated the round robin tournament 10 times (this is to deal with the stochasticity of the random players).
91
90
The :code:`normalised_scores` contains a list of normalized scores for all players.
@@ -104,20 +103,20 @@ Finally, to obtain the ranking in a helpful format with all the names::
104
103
105
104
which gives::
106
105
107
-
['Defector', 'Defector', 'Alternator', 'Tit For Tat', 'Random: 0.5', 'Cooperator']
108
-
106
+
['Defector', 'Defector', 'Alternator', 'Tit For Tat', 'Random', 'Cooperator']
109
107
110
108
So in this particular instance our two defectors have won.
111
-
Let us write a little script that will throw in a new :code:`TitForTat` player until the Tit-For-Tat player wins::
109
+
Let us write a little script that will throw in a new :code:`TitForTat` player until the tit for tat player wins::
112
110
113
-
while results.ranked_names[0] == 'Defector':
111
+
while ranks[0] == 'Defector':
114
112
strategies.append(axelrod.TitForTat()) # Adding a new tit for tat player
115
113
tournament = axelrod.Tournament(strategies)
116
114
results = tournament.play()
115
+
ranks = results.ranked_names
117
116
118
117
Once that has run let us see how many :code:`TitForTat` players were required::
119
118
120
-
results.ranked_names.count('Tit For Tat')
119
+
ranks.count('Tit For Tat')
121
120
122
121
which gives::
123
122
@@ -126,7 +125,7 @@ which gives::
126
125
We can wrap all this in a function and use it to see how many :code:`TitForTat` are needed to overcome a varying number :code:`Defector`::
To further study how this system evolves over time and how robust some of the observations we have made are let us look at how this game can be interpreted in an ecological setting.
367
366
368
367
The previous examples seem to indicate that even with a large amount of :code:`Defector`, :code:`TitForTat` wins the tournament.
369
-
However, the Nash equilibria for the basic tournament shows that we have equilibria involving both those two strategies.
368
+
However, the Nash equilibria for the demo tournament shows that we have equilibria involving both those two strategies.
370
369
371
370
An ecological variant of the tournament can be run with this library which allows to see how each strategy does in a population over time where the performance in the tournament indicates how likely the given strategy is to reproduce. To create such a variant simply run::
372
371
373
372
import axelrod
374
-
strategies = [s() for s in axelrod.basic_strategies]
373
+
strategies = [s() for s in axelrod.demo_strategies]
375
374
tournament = axelrod.Tournament(strategies)
376
375
results = tournament.play()
377
376
eco = axelrod.Ecosystem(results)
378
-
eco.reproduce(50) # Evolve the population over 50 time steps
377
+
eco.reproduce(100) # Evolve the population over 100 time steps
0 commit comments