Skip to content

Commit bc03a2d

Browse files
corrects typo mistakes and make some readability changes
1 parent 10489ae commit bc03a2d

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

axelrod/strategies/dbs.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class DBS(Player):
1010
Desired Belief Strategy as described in [Au2006]_
1111
http://www.cs.utexas.edu/%7Echiu/papers/Au06NoisyIPD.pdf
1212
13-
A strategy that learns the opponent's strategy, and use symbolic
13+
A strategy that learns the opponent's strategy, and uses symbolic
1414
noise detection for detecting whether anomalies in player’s behavior
1515
are deliberate or accidental, hence increasing performance in noisy
1616
tournaments.
@@ -111,8 +111,8 @@ def should_promote(self, r_plus, promotion_threshold=3):
111111
opposite_action = 1
112112
k = 1
113113
count = 0
114-
# We iterates on the history, while we do not encounter
115-
# counter-exemples of r_plus, i.e. while we do not encounter
114+
# We iterate on the history, while we do not encounter
115+
# counter-examples of r_plus, i.e. while we do not encounter
116116
# r_minus
117117
while(
118118
k < len(self.history_by_cond[r_plus[0]][0])
@@ -129,9 +129,7 @@ def should_promote(self, r_plus, promotion_threshold=3):
129129
return False
130130

131131
def should_demote(self, r_minus, violation_threshold=4):
132-
if(self.violation_counts[r_minus[0]] >= violation_threshold):
133-
return True
134-
return False
132+
return (self.violation_counts[r_minus[0]] >= violation_threshold)
135133

136134
def update_history_by_cond(self, opponent_history):
137135
two_moves_ago = (self.history[-2], opponent_history[-2])
@@ -306,14 +304,13 @@ def is_stochastic(self):
306304
return False
307305

308306
def get_value(self):
309-
if (self.action1 == C and self.action2 == C):
310-
return 3
311-
elif (self.action1 == C and self.action2 == D):
312-
return 0
313-
elif (self.action1 == D and self.action2 == C):
314-
return 5
315-
elif (self.action1 == D and self.action2 == D):
316-
return 1
307+
values = {
308+
(C, C): 3,
309+
(C, D): 0,
310+
(D, C): 5,
311+
(D, D): 1
312+
}
313+
return values[(self.action1, self.action2)]
317314

318315

319316
def create_policy(pCC, pCD, pDC, pDD):

0 commit comments

Comments
 (0)