Skip to content

Commit ef33daa

Browse files
marcharperdrvinceknight
authored andcommitted
Remove redundant member functions of the Action class
1 parent 09b92e5 commit ef33daa

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

axelrod/action.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, *args):
2020

2121
@total_ordering
2222
class Action(Enum):
23-
"""Core actions in the Prisoner's Dilemna.
23+
"""Core actions in the Prisoner's Dilemma.
2424
2525
There are only two possible actions, namely Cooperate or Defect,
2626
which are called C and D for convenience.
@@ -29,23 +29,14 @@ class Action(Enum):
2929
C = 1 # Cooperate
3030
D = 0 # Defect
3131

32-
def __bool__(self):
33-
return bool(self.value)
34-
35-
def __eq__(self, other):
36-
return self.value == other.value
37-
38-
def __hash__(self):
39-
return hash(self.value)
40-
4132
def __lt__(self, other):
4233
return self.value < other.value
4334

4435
def __repr__(self):
45-
return "{}".format(self.name)
36+
return self.name
4637

4738
def __str__(self):
48-
return "{}".format(self.name)
39+
return repr(self)
4940

5041
def flip(self):
5142
"""Returns the opposite Action."""

0 commit comments

Comments
 (0)