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 384d49c commit 9c397abCopy full SHA for 9c397ab
axelrod/strategies/worse_and_worse.py
@@ -1,5 +1,4 @@
1
-from axelrod import Actions, Player
2
-from random import randint, choice
+from axelrod import Actions, Player, random_choice
3
4
C, D = Actions.C, Actions.D
5
@@ -27,9 +26,5 @@ class WorseAndWorse (Player):
27
26
def strategy(self, opponent):
28
current_round = len(self.history) + 1
29
expected_length = self.match_attributes['length']
30
- try:
31
- if randint(0, expected_length) < (current_round):
32
- return D
33
- return C
34
- except ValueError:
35
- choice([C, D])
+ probability = 1 - float(current_round) / expected_length
+ return random_choice(probability)
0 commit comments