Skip to content

Commit a6935a4

Browse files
authored
Moved seed to parameter
1 parent d5c8f77 commit a6935a4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

axelrod/tests/strategies/test_axelrod_second.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,30 +509,27 @@ def test_strategy(self):
509509
self.versus_test(axelrod.Cooperator(), expected_actions=actions)
510510

511511
# It will take until turn 18 to respond decide to repond D->D
512-
random.seed(1)
513512
actions = [(C, D)]
514513
actions += [(C, D), (D, D), (D, D), (C, D), (C, D), (C, D), (D, D),
515514
(D, D), (C, D), (C, D), (D, D), (C, D), (D, D), (C, D),
516515
(C, D), (D, D), (C, D)] # Randomly choose
517516
actions += [(D, D)] * 30 # Defect
518-
self.versus_test(axelrod.Defector(), expected_actions=actions)
517+
self.versus_test(axelrod.Defector(), expected_actions=actions, seed=1)
519518

520519
# Highly-defective opponent
521520
# It will take until turn 20 to respond decide to repond D to C
522521
opponent_actions = [D] * 17 + [C, C, C, C]
523522
almost_defector = axelrod.MockPlayer(actions=opponent_actions)
524523

525-
random.seed(1)
526524
actions = [(C, D)]
527525
actions += [(C, D), (D, D), (D, D), (C, D), (C, D), (C, D), (D, D),
528526
(D, D), (C, D), (C, D), (D, D), (C, D), (D, D), (C, D),
529527
(C, D), (D, D), (C, C)] # Randomly choose
530528
actions += [(C, C)] # Coop for a minute
531529
actions += [(D, C), (D, C)]
532-
self.versus_test(almost_defector, expected_actions=actions)
530+
self.versus_test(almost_defector, expected_actions=actions, seed=1)
533531

534532
#Here it will take until turn 40 to detect random and defect
535-
random.seed(2)
536533
actions = [(C, C)]
537534
actions += [(C, D), (D, C), (C, D), (D, C), (C, D), (C, C), (C, D),
538535
(C, C), (C, D), (D, C), (C, D), (D, C), (C, D), (D, C),
@@ -541,4 +538,4 @@ def test_strategy(self):
541538
(C, D), (D, C), (C, D), (D, C), (C, D), (D, C), (C, D)] #Randomly choose
542539
actions += [(D, C), (C, D), (D, C)] # 17 D have come, so tit for tat for a while
543540
actions += [(D, D), (D, C)] * 100 # Random finally detected
544-
self.versus_test(axelrod.Alternator(), expected_actions=actions)
541+
self.versus_test(axelrod.Alternator(), expected_actions=actions, seed=2)

0 commit comments

Comments
 (0)