Skip to content

Commit

Permalink
Merge pull request #1023 from Axelrod-Python/884-prober
Browse files Browse the repository at this point in the history
Refactor tests for Prober.
  • Loading branch information
marcharper authored May 25, 2017
2 parents 7a65c17 + e0f5359 commit 1d3d81f
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 139 deletions.
40 changes: 27 additions & 13 deletions axelrod/strategies/prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class CollectiveStrategy(Player):
"""Defined in [Li2009]. 'It always cooperates in the first move and defects
"""Defined in [Li2009]_. 'It always cooperates in the first move and defects
in the second move. If the opponent also cooperates in the first move and
defects in the second move, CS will cooperate until the opponent defects.
Otherwise, CS will always defect.'
Expand Down Expand Up @@ -50,6 +50,10 @@ class Prober(Player):
"""
Plays D, C, C initially. Defects forever if opponent cooperated in moves 2
and 3. Otherwise plays TFT.
Names:
- Prober [Li2011]_
"""

name = 'Prober'
Expand Down Expand Up @@ -83,6 +87,10 @@ class Prober2(Player):
"""
Plays D, C, C initially. Cooperates forever if opponent played D then C
in moves 2 and 3. Otherwise plays TFT.
Names:
- Prober 2: [Prison1998]_
"""

name = 'Prober 2'
Expand Down Expand Up @@ -116,6 +124,10 @@ class Prober3(Player):
"""
Plays D, C initially. Defects forever if opponent played C in moves 2.
Otherwise plays TFT.
Names:
- Prober 3: [Prison1998]_
"""

name = 'Prober 3'
Expand Down Expand Up @@ -153,7 +165,7 @@ class Prober4(Player):
Names:
- prober4: [Prison1998]_
- Prober 4: [Prison1998]_
"""

name = 'Prober 4'
Expand Down Expand Up @@ -208,6 +220,10 @@ class HardProber(Player):
"""
Plays D, D, C, C initially. Defects forever if opponent cooperated in moves
2 and 3. Otherwise plays TFT.
Names:
- Hard Prober: [Prison1998]_
"""

name = 'Hard Prober'
Expand Down Expand Up @@ -243,10 +259,9 @@ class NaiveProber(Player):
"""
Like tit-for-tat, but it occasionally defects with a small probability.
For reference see: "Engineering Design of Strategies for Winning
Iterated Prisoner's Dilemma Competitions" by Jiawei Li, Philip Hingston,
and Graham Kendall. IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI
IN GAMES, VOL. 3, NO. 4, DECEMBER 2011
Names:
- Naive Prober: [Li2011]_
"""

name = 'Naive Prober'
Expand Down Expand Up @@ -289,17 +304,16 @@ class RemorsefulProber(NaiveProber):
Like Naive Prober, but it remembers if the opponent responds to a random
defection with a defection by being remorseful and cooperating.
For reference see: "Engineering Design of Strategies for Winning
Iterated Prisoner's Dilemma Competitions" by Jiawei Li, Philip Hingston,
and Graham Kendall. IEEE TRANSACTIONS ON COMPUTATIONAL INTELLIGENCE AND AI
IN GAMES, VOL. 3, NO. 4, DECEMBER 2011
A more complete description is given in "The Selfish Gene"
(https://books.google.co.uk/books?id=ekonDAAAQBAJ):
For reference see: [Li2011]_. A more complete description is given in "The
Selfish Gene" (https://books.google.co.uk/books?id=ekonDAAAQBAJ):
"Remorseful Prober remembers whether it has just spontaneously defected, and
whether the result was prompt retaliation. If so, it 'remorsefully' allows
its opponent 'one free hit' without retaliating."
Names:
- Remorseful Prober: [Li2011]_
"""

name = 'Remorseful Prober'
Expand Down
Loading

0 comments on commit 1d3d81f

Please sign in to comment.