We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c612c1e commit f6479f7Copy full SHA for f6479f7
axelrod/strategies/titfortat.py
@@ -826,6 +826,7 @@ def __init__(self, p: float=0.5) -> None:
826
"""
827
super().__init__()
828
self.p = p
829
+ self.act_random = False
830
if p in [0, 1]:
831
self.classifier['stochastic'] = False
832
@@ -834,6 +835,10 @@ def strategy(self, opponent: Player) -> Action:
834
835
"""This is the actual strategy"""
836
if not self.history:
837
return C
- if len(opponent.history) % 2 == 0:
838
+
839
+ if self.act_random:
840
841
return random_choice(self.p)
842
843
+ self.act_random = True
844
return opponent.history[-1]
0 commit comments