Skip to content

Commit 0e6b7d5

Browse files
author
margaret
committed
Fix bugs
Add init_args decorator Add Player class init to Prober4's init Correct inconsistent variable naming Correct typos
1 parent 3a95e76 commit 0e6b7d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

axelrod/strategies/prober.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ class Prober4(Player):
121121
'manipulates_state': False
122122
}
123123

124+
@init_args
124125
def __init__(self):
126+
Player.__init__(self)
125127
self.probe_sequence = [C, C, D, C, D, D, D, C, C, D,
126128
C, D, C, C, D, C, D, D, C, D]
127-
self.probe_lenght = len(self.probe_sequence)
129+
self.probe_length = len(self.probe_sequence)
128130
self.politness_pool = [C, C, C, C, C]
129131
self.is_angry = False
130132

@@ -134,7 +136,7 @@ def strategy(self, opponent):
134136
return self.probe_sequence[turn - 1]
135137
if turn == self.probe_length + 1:
136138
self.judge(opponent)
137-
if self.angry:
139+
if self.is_angry:
138140
return D
139141
else:
140142
# Cooperate for the next 5 turns
@@ -147,7 +149,7 @@ def strategy(self, opponent):
147149
def judge(self, opponent):
148150
just_defect = 0
149151
unjust_defect = 0
150-
for turn in range(self.probe_lenght):
152+
for turn in range(self.probe_length):
151153
if opponent.history[turn + 1] == D:
152154
if self.history[turn] == C:
153155
unjust_defect += 1

0 commit comments

Comments
 (0)