Skip to content

Commit b54c272

Browse files
committed
Rename Stein and Rapoport.
1 parent 75ee7c5 commit b54c272

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

axelrod/strategies/_strategies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
FirstByNydegger,
1515
RevisedDowning,
1616
FirstByShubik,
17-
SteinAndRapoport,
17+
FirstBySteinAndRapoport,
1818
TidemanAndChieruzzi,
1919
FirstByTullock,
2020
FirstByAnonymous,
@@ -413,7 +413,7 @@
413413
SolutionB5,
414414
SpitefulTitForTat,
415415
Stalker,
416-
SteinAndRapoport,
416+
FirstBySteinAndRapoport,
417417
StochasticCooperator,
418418
StochasticWSLS,
419419
SuspiciousTitForTat,

axelrod/strategies/axelrod_first.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,14 +692,25 @@ def strategy(opponent: Player) -> Action:
692692

693693

694694
@FinalTransformer((D, D), name_prefix=None)
695-
class SteinAndRapoport(Player):
696-
"""This strategy plays a modification of Tit For Tat.
695+
class FirstBySteinAndRapoport(Player):
696+
"""
697+
Submitted to Axelrod's first tournament by William Stein and Amnon Rapoport.
698+
699+
The description written in [Axelrod1980]_ is:
700+
701+
> "This rule plays tit for tat except that it cooperates on the first four
702+
> moves, it defects on the last two moves, and every fifteen moves it checks
703+
> to see if the opponent seems to be playing randomly. This check uses a
704+
> chi-squared test of the other's transition probabilities and also checks for
705+
> alternating moves of CD and DC.
706+
707+
This is implemented as follows:
697708
698709
1. It cooperates for the first 4 moves.
699710
2. It defects on the last 2 moves.
700711
3. Every 15 moves it makes use of a `chi-squared
701712
test <http://en.wikipedia.org/wiki/Chi-squared_test>`_ to check if the
702-
opponent is playing randomly.
713+
opponent is playing randomly. If so it defects.
703714
704715
This strategy came 6th in Axelrod's original tournament.
705716
@@ -708,7 +719,7 @@ class SteinAndRapoport(Player):
708719
- SteinAndRapoport: [Axelrod1980]_
709720
"""
710721

711-
name = "Stein and Rapoport"
722+
name = "First tournament by Stein and Rapoport"
712723
classifier = {
713724
"memory_depth": float("inf"),
714725
"stochastic": False,

axelrod/tests/strategies/test_axelrod_first.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ def test_strategy(self):
470470
self.versus_test(axelrod.Cooperator(), expected_actions=actions, seed=10)
471471

472472

473-
class TestSteinAndRapoport(TestPlayer):
473+
class TestFirstBySteinAndRapoport(TestPlayer):
474474

475-
name = "Stein and Rapoport: 0.05: (D, D)"
476-
player = axelrod.SteinAndRapoport
475+
name = "First tournament by Stein and Rapoport: 0.05: (D, D)"
476+
player = axelrod.FirstBySteinAndRapoport
477477
expected_classifier = {
478478
"memory_depth": float("inf"),
479479
"long_run_time": False,

docs/reference/overview_of_strategies.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ An indication is given as to whether or not this strategy is implemented in the
2121
"Nydegger", "Rudy Nydegger", ":class:`Nydegger <axelrod.strategies.axelrod_first.FirstByNydegger>`"
2222
"Grofman", "Bernard Grofman", ":class:`Grofman <axelrod.strategies.axelrod_first.FirstByGrofman>`"
2323
"Shubik", "Martin Shubik", ":class:`Shubik <axelrod.strategies.axelrod_first.FirstByShubik>`"
24-
"Stein and Rapoport", "Stein and Anatol Rapoport", ":class:`SteinAndRapoport <axelrod.strategies.axelrod_first.SteinAndRapoport>`"
24+
"Stein and Rapoport", "Stein and Anatol Rapoport", ":class:`SteinAndRapoport <axelrod.strategies.axelrod_first.FirstBySteinAndRapoport>`"
2525
"Grudger", "James W Friedman", ":class:`Grudger <axelrod.strategies.grudger.Grudger>`"
2626
"Davis", "Morton Davis", ":class:`Davis <axelrod.strategies.axelrod_first.FirstByDavis>`"
2727
"Graaskamp", "Jim Graaskamp", ":class:`Graaskamp <axelrod.strategies.axelrod_first.FirstByGraaskamp>`"

0 commit comments

Comments
 (0)