Skip to content

Commit 46803d8

Browse files
yohmmarcharper
authored andcommitted
refactoring
1 parent ee4eb1c commit 46803d8

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

axelrod/strategies/grudger.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,28 +394,24 @@ def strategy(self, opponent: Player) -> Action:
394394
return C
395395
if hist == [(D, C), (C, D), (C, C)]:
396396
return C
397-
if hist == [(C, D), (C, C), (C, C)]:
397+
if hist == [(C, D), (C, C), (C, C)]: # Rule: A & R2
398398
return C
399399
if hist == [(C, C), (C, C), (C, D)]: # Rule: P
400400
return D
401401
if hist == [(C, C), (C, D), (D, C)]:
402402
return C
403403
if hist == [(C, D), (D, C), (C, C)]:
404404
return C
405-
if hist == [(D, C), (C, C), (C, C)]:
405+
if hist == [(D, C), (C, C), (C, C)]: # Rule: P & R1
406406
return C
407407
if hist == [(D, D), (D, D), (D, C)]: # Rule: R1
408408
return C
409409
if hist == [(D, D), (D, C), (C, C)]:
410410
return C
411-
# if hist == [(D, C), (C, C), (C, C)]: # duplicate of Rule P
412-
# return(C
413411
if hist == [(D, D), (D, D), (C, D)]: # Rule: R2
414412
return C
415413
if hist == [(D, D), (C, D), (C, C)]:
416414
return C
417-
# if hist == [(C, D), (C, C), (C, C)]: # duplicate of Rule A
418-
# return(C
419415
if hist == [(D, D), (D, D), (C, C)]: # Rule: R3
420416
return C
421417
if hist == [(D, D), (C, C), (C, C)]:

axelrod/tests/strategies/test_grudger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,6 @@ class TestCapri(TestPlayer):
352352
"manipulates_state": False,
353353
}
354354

355-
def assert_prescription(self, player_history, opponent_history, prescription):
356-
player = self.player()
357-
player._history = player_history
358-
opponent = axl.MockPlayer()
359-
opponent._history = opponent_history
360-
self.assertEqual(player.strategy(opponent=opponent), prescription)
361-
362355
def test_strategy(self):
363356
# cooperate at mutual cooperation
364357
opponent = axl.Cooperator()

0 commit comments

Comments
 (0)