Skip to content

Commit 593ae56

Browse files
committed
sorting out try/except setup as per Vince's request.
1 parent 5b6ebfb commit 593ae56

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

axelrod/strategies/worse_and_worse.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from axelrod import Actions, Player
2-
from random import randint
2+
from random import randint, choice
3+
4+
C, D = Actions.C, Actions.D
35

46
class WorseAndWorse (Player):
57
"""
@@ -27,9 +29,7 @@ def strategy(self, opponent):
2729
expected_length = self.match_attributes['length']
2830
try:
2931
if randint(0, expected_length) < (current_round):
30-
return Actions.D
31-
return Actions.C
32-
except:
33-
if randint(0, 200) < (current_round):
34-
return Actions.D
35-
return Actions.C
32+
return D
33+
return C
34+
except ValueError:
35+
choice([C, D])

0 commit comments

Comments
 (0)