Skip to content

Commit aedb71a

Browse files
yohmmarcharper
authored andcommitted
commented out unused code
to make the coverage 100%, codes that never run are commented out
1 parent 141f646 commit aedb71a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

axelrod/strategies/grudger.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,14 @@ def strategy(self, opponent: Player) -> Action:
409409
return C
410410
if hist == [[D, D], [D, C], [C, C]]:
411411
return C
412-
if hist == [[D, C], [C, C], [C, C]]:
413-
return C
412+
# if hist == [[D, C], [C, C], [C, C]]: # duplicate of Rule P
413+
# return C
414414
if hist == [[D, D], [D, D], [C, D]]: # Rule: R2
415415
return C
416416
if hist == [[D, D], [C, D], [C, C]]:
417417
return C
418-
if hist == [[C, D], [C, C], [C, C]]:
419-
return C
418+
# if hist == [[C, D], [C, C], [C, C]]: # duplicate of Rule A
419+
# return C
420420
if hist == [[D, D], [D, D], [C, C]]: # Rule: R3
421421
return C
422422
if hist == [[D, D], [C, C], [C, C]]:

axelrod/tests/strategies/test_grudger.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,15 +382,17 @@ def test_strategy(self):
382382
actions = [(C, C)] * 10 + [(C, D)] + [(D, D)] + [(D,C)] * 9
383383
self.versus_test(opponent, expected_actions=actions)
384384

385+
def test_prescriptions(self):
385386
# accept punishment when making a mistake
386387
self.assert_prescription([C,C,D], [C,C,C], C)
387388
self.assert_prescription([C,D,C], [C,C,D], C)
388389
self.assert_prescription([D,C,C], [C,D,C], C)
389390
self.assert_prescription([C,C,C], [D,C,C], C)
390391

391-
# recover the cooperation
392+
# recover the cooperation from mutual defection
392393
self.assert_prescription([D,D,C], [D,D,D], C)
393394
self.assert_prescription([D,C,C], [D,D,C], C)
395+
self.assert_prescription([C,C,C], [D,C,C], C)
394396

395397
self.assert_prescription([D,D,D], [D,D,C], C)
396398
self.assert_prescription([D,D,C], [D,C,C], C)

0 commit comments

Comments
 (0)