Skip to content

Commit b9b4a6b

Browse files
authored
Merge pull request #692 from Axelrod-Python/690
Add long_run_time classifier
2 parents 304cb90 + 0e2a9bf commit b9b4a6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+241
-10
lines changed

axelrod/player.py

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class Player(object):
7373
'stochastic': False,
7474
'memory_depth': float('inf'),
7575
'makes_use_of': None,
76+
'long_run_time': False,
7677
'inspects_source': None,
7778
'manipulates_source': None,
7879
'manipulates_state': None

axelrod/strategies/__init__.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,20 @@
1212
MetaMixer
1313
)
1414

15-
all_strategies.append(MetaHunter)
15+
all_strategies.extend([MetaHunter, MetaMajority, MetaMinority, MetaWinner,
16+
MetaMajorityMemoryOne, MetaWinnerMemoryOne,
17+
MetaMajorityFiniteMemory, MetaWinnerFiniteMemory,
18+
MetaMajorityLongMemory, MetaWinnerLongMemory, MetaMixer])
1619

17-
long_run_time_strategies = [MetaMajority, MetaMinority, MetaWinner,
18-
MetaMajorityMemoryOne, MetaWinnerMemoryOne,
19-
MetaMajorityFiniteMemory, MetaWinnerFiniteMemory,
20-
MetaMajorityLongMemory, MetaWinnerLongMemory, MetaMixer]
21-
22-
all_strategies.extend(long_run_time_strategies)
2320

2421
# Distinguished strategy collections in addition to
2522
# `all_strategies` from _strategies.py
26-
2723
demo_strategies = [Cooperator, Defector, TitForTat, Grudger, Random]
2824
basic_strategies = [s for s in all_strategies if is_basic(s())]
2925
strategies = [s for s in all_strategies if obey_axelrod(s())]
26+
27+
long_run_time_strategies = [s for s in all_strategies if
28+
s().classifier['long_run_time']]
3029
cheating_strategies = [s for s in all_strategies if not obey_axelrod(s())]
3130

3231
ordinary_strategies = strategies # This is a legacy and will be removed

axelrod/strategies/adaptive.py

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Adaptive(Player):
1212
'memory_depth': float('inf'), # Long memory
1313
'stochastic': False,
1414
'makes_use_of': set(["game"]),
15+
'long_run_time': False,
1516
'inspects_source': False,
1617
'manipulates_source': False,
1718
'manipulates_state': False

axelrod/strategies/alternator.py

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Alternator(Player):
99
'memory_depth': 1,
1010
'stochastic': False,
1111
'makes_use_of': set(),
12+
'long_run_time': False,
1213
'inspects_source': False,
1314
'manipulates_source': False,
1415
'manipulates_state': False

axelrod/strategies/apavlov.py

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class APavlov2006(Player):
1919
'memory_depth': float('inf'),
2020
'stochastic': False,
2121
'makes_use_of': set(),
22+
'long_run_time': False,
2223
'inspects_source': False,
2324
'manipulates_source': False,
2425
'manipulates_state': False
@@ -85,6 +86,7 @@ class APavlov2011(Player):
8586
'memory_depth': float('inf'),
8687
'stochastic': False,
8788
'makes_use_of': set(),
89+
'long_run_time': False,
8890
'inspects_source': False,
8991
'manipulates_source': False,
9092
'manipulates_state': False

axelrod/strategies/appeaser.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Appeaser(Player):
1414
'memory_depth': float('inf'), # Depends on internal memory.
1515
'stochastic': False,
1616
'makes_use_of': set(),
17+
'long_run_time': False,
1718
'inspects_source': False,
1819
'manipulates_source': False,
1920
'manipulates_state': False

axelrod/strategies/averagecopier.py

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class AverageCopier(Player):
1212
'memory_depth': float('inf'), # Long memory
1313
'stochastic': True,
1414
'makes_use_of': set(),
15+
'long_run_time': False,
1516
'inspects_source': False,
1617
'manipulates_source': False,
1718
'manipulates_state': False
@@ -34,6 +35,7 @@ class NiceAverageCopier(Player):
3435
'memory_depth': float('inf'), # Long memory
3536
'stochastic': True,
3637
'makes_use_of': set(),
38+
'long_run_time': False,
3739
'inspects_source': False,
3840
'manipulates_source': False,
3941
'manipulates_state': False

axelrod/strategies/axelrod_first.py

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Davis(Player):
2020
'memory_depth': float('inf'), # Long memory
2121
'stochastic': False,
2222
'makes_use_of': set(),
23+
'long_run_time': False,
2324
'inspects_source': False,
2425
'manipulates_source': False,
2526
'manipulates_state': False
@@ -58,6 +59,7 @@ class RevisedDowning(Player):
5859
'memory_depth': float('inf'),
5960
'stochastic': False,
6061
'makes_use_of': set(),
62+
'long_run_time': False,
6163
'inspects_source': False,
6264
'manipulates_source': False,
6365
'manipulates_state': False
@@ -134,6 +136,7 @@ class Feld(Player):
134136
'memory_depth': 200, # Varies actually, eventually becomes depth 1
135137
'stochastic': True,
136138
'makes_use_of': set(),
139+
'long_run_time': False,
137140
'inspects_source': False,
138141
'manipulates_source': False,
139142
'manipulates_state': False
@@ -189,6 +192,7 @@ class Grofman(Player):
189192
'memory_depth': float('inf'),
190193
'stochastic': True,
191194
'makes_use_of': set(),
195+
'long_run_time': False,
192196
'inspects_source': False,
193197
'manipulates_source': False,
194198
'manipulates_state': False
@@ -260,6 +264,7 @@ class Nydegger(Player):
260264
'memory_depth': 3,
261265
'stochastic': False,
262266
'makes_use_of': set(),
267+
'long_run_time': False,
263268
'inspects_source': False,
264269
'manipulates_source': False,
265270
'manipulates_state': False
@@ -314,6 +319,7 @@ class Shubik(Player):
314319
'memory_depth': float('inf'),
315320
'stochastic': False,
316321
'makes_use_of': set(),
322+
'long_run_time': False,
317323
'inspects_source': False,
318324
'manipulates_source': False,
319325
'manipulates_state': False
@@ -373,6 +379,7 @@ class Tullock(Player):
373379
'memory_depth': 11, # long memory, modified by init
374380
'stochastic': True,
375381
'makes_use_of': set(),
382+
'long_run_time': False,
376383
'inspects_source': False,
377384
'manipulates_source': False,
378385
'manipulates_state': False
@@ -427,6 +434,7 @@ class UnnamedStrategy(Player):
427434
'memory_depth': 0,
428435
'stochastic': True,
429436
'makes_use_of': set(),
437+
'long_run_time': False,
430438
'inspects_source': False,
431439
'manipulates_source': False,
432440
'manipulates_state': False

axelrod/strategies/axelrod_second.py

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Champion(Player):
1919
'memory_depth': float('inf'),
2020
'stochastic': True,
2121
'makes_use_of': set(["length"]),
22+
'long_run_time': False,
2223
'inspects_source': False,
2324
'manipulates_source': False,
2425
'manipulates_state': False
@@ -54,6 +55,7 @@ class Eatherley(Player):
5455
'memory_depth': float('inf'),
5556
'stochastic': True,
5657
'makes_use_of': set(),
58+
'long_run_time': False,
5759
'inspects_source': False,
5860
'manipulates_source': False,
5961
'manipulates_state': False
@@ -86,6 +88,7 @@ class Tester(Player):
8688
'memory_depth': float('inf'),
8789
'stochastic': False,
8890
'makes_use_of': set(),
91+
'long_run_time': False,
8992
'inspects_source': False,
9093
'manipulates_source': False,
9194
'manipulates_state': False

axelrod/strategies/backstabber.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class BackStabber(Player):
1616
'memory_depth': float('inf'),
1717
'stochastic': False,
1818
'makes_use_of': set(['length']),
19+
'long_run_time': False,
1920
'inspects_source': False,
2021
'manipulates_source': False,
2122
'manipulates_state': False
@@ -43,6 +44,7 @@ class DoubleCrosser(Player):
4344
'memory_depth': float('inf'),
4445
'stochastic': False,
4546
'makes_use_of': set(['length']),
47+
'long_run_time': False,
4648
'inspects_source': False,
4749
'manipulates_source': False,
4850
'manipulates_state': False

axelrod/strategies/calculator.py

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Calculator(Player):
1414
'memory_depth': float('inf'),
1515
'stochastic': True,
1616
'makes_use_of': set(),
17+
'long_run_time': False,
1718
'inspects_source': False,
1819
'manipulates_source': False,
1920
'manipulates_state': False

axelrod/strategies/cooperator.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Cooperator(Player):
1111
'memory_depth': 0,
1212
'stochastic': False,
1313
'makes_use_of': set(),
14+
'long_run_time': False,
1415
'inspects_source': False,
1516
'manipulates_source': False,
1617
'manipulates_state': False
@@ -29,6 +30,7 @@ class TrickyCooperator(Player):
2930
'memory_depth': 10,
3031
'stochastic': False,
3132
'makes_use_of': set(),
33+
'long_run_time': False,
3234
'inspects_source': False,
3335
'manipulates_source': False,
3436
'manipulates_state': False

axelrod/strategies/cycler.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class AntiCycler(Player):
1313
'memory_depth': float('inf'),
1414
'stochastic': False,
1515
'makes_use_of': set(),
16+
'long_run_time': False,
1617
'inspects_source': False,
1718
'manipulates_source': False,
1819
'manipulates_state': False
@@ -46,6 +47,7 @@ class Cycler(Player):
4647
'memory_depth': 1,
4748
'stochastic': False,
4849
'makes_use_of': set(),
50+
'long_run_time': False,
4951
'inspects_source': False,
5052
'manipulates_source': False,
5153
'manipulates_state': False

axelrod/strategies/darwin.py

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class Darwin(Player):
2626
'memory_depth': float('inf'),
2727
'stochastic': False,
2828
'inspects_source': False,
29+
'long_run_time': False,
2930
'makes_use_of': set(),
3031
'manipulates_source': False,
3132
'manipulates_state': True # Does not reset properly.

axelrod/strategies/defector.py

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Defector(Player):
1010
'memory_depth': 0,
1111
'stochastic': False,
1212
'makes_use_of': set(),
13+
'long_run_time': False,
1314
'inspects_source': False,
1415
'manipulates_source': False,
1516
'manipulates_state': False
@@ -28,6 +29,7 @@ class TrickyDefector(Player):
2829
'memory_depth': float('inf'), # Long memory
2930
'stochastic': False,
3031
'makes_use_of': set(),
32+
'long_run_time': False,
3133
'inspects_source': False,
3234
'manipulates_source': False,
3335
'manipulates_state': False

axelrod/strategies/finite_state_machines.py

+9
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class FSMPlayer(Player):
4141
'memory_depth': 1,
4242
'stochastic': False,
4343
'makes_use_of': set(),
44+
'long_run_time': False,
4445
'inspects_source': False,
4546
'manipulates_source': False,
4647
'manipulates_state': False
@@ -83,6 +84,7 @@ class Fortress3(FSMPlayer):
8384
'memory_depth': 3,
8485
'stochastic': False,
8586
'makes_use_of': set(),
87+
'long_run_time': False,
8688
'inspects_source': False,
8789
'manipulates_source': False,
8890
'manipulates_state': False
@@ -110,6 +112,7 @@ class Fortress4(FSMPlayer):
110112
'memory_depth': 4,
111113
'stochastic': False,
112114
'makes_use_of': set(),
115+
'long_run_time': False,
113116
'inspects_source': False,
114117
'manipulates_source': False,
115118
'manipulates_state': False
@@ -137,6 +140,7 @@ class Predator(FSMPlayer):
137140
'memory_depth': 9,
138141
'stochastic': False,
139142
'makes_use_of': set(),
143+
'long_run_time': False,
140144
'inspects_source': False,
141145
'manipulates_source': False,
142146
'manipulates_state': False
@@ -174,6 +178,7 @@ class Raider(FSMPlayer):
174178
'memory_depth': 3,
175179
'stochastic': False,
176180
'makes_use_of': set(),
181+
'long_run_time': False,
177182
'inspects_source': False,
178183
'manipulates_source': False,
179184
'manipulates_state': False
@@ -201,6 +206,7 @@ class Ripoff(FSMPlayer):
201206
'memory_depth': 2,
202207
'stochastic': False,
203208
'makes_use_of': set(),
209+
'long_run_time': False,
204210
'inspects_source': False,
205211
'manipulates_source': False,
206212
'manipulates_state': False
@@ -226,6 +232,7 @@ class SolutionB1(FSMPlayer):
226232
'memory_depth': 3,
227233
'stochastic': False,
228234
'makes_use_of': set(),
235+
'long_run_time': False,
229236
'inspects_source': False,
230237
'manipulates_source': False,
231238
'manipulates_state': False
@@ -251,6 +258,7 @@ class SolutionB5(FSMPlayer):
251258
'memory_depth': 5,
252259
'stochastic': False,
253260
'makes_use_of': set(),
261+
'long_run_time': False,
254262
'inspects_source': False,
255263
'manipulates_source': False,
256264
'manipulates_state': False
@@ -282,6 +290,7 @@ class Thumper(FSMPlayer):
282290
'memory_depth': 2,
283291
'stochastic': False,
284292
'makes_use_of': set(),
293+
'long_run_time': False,
285294
'inspects_source': False,
286295
'manipulates_source': False,
287296
'manipulates_state': False

axelrod/strategies/forgiver.py

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Forgiver(Player):
1313
'memory_depth': float('inf'), # Long memory
1414
'stochastic': False,
1515
'makes_use_of': set(),
16+
'long_run_time': False,
1617
'inspects_source': False,
1718
'manipulates_source': False,
1819
'manipulates_state': False
@@ -40,6 +41,7 @@ class ForgivingTitForTat(Player):
4041
'memory_depth': float('inf'), # Long memory
4142
'stochastic': False,
4243
'makes_use_of': set(),
44+
'long_run_time': False,
4345
'inspects_source': False,
4446
'manipulates_source': False,
4547
'manipulates_state': False

axelrod/strategies/gambler.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Gambler(LookerUp):
1919
'memory_depth': float('inf'),
2020
'stochastic': True,
2121
'makes_use_of': set(['length']),
22+
'long_run_time': False,
2223
'inspects_source': False,
2324
'manipulates_source': False,
2425
'manipulates_state': False

axelrod/strategies/geller.py

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Geller(Player):
3535
'memory_depth': -1,
3636
'stochastic': True,
3737
'makes_use_of': set(),
38+
'long_run_time': False,
3839
'inspects_source': True, # Finds out what opponent will do
3940
'manipulates_source': False,
4041
'manipulates_state': False
@@ -65,6 +66,7 @@ class GellerCooperator(Geller):
6566
'memory_depth': -1,
6667
'stochastic': False,
6768
'makes_use_of': set(),
69+
'long_run_time': False,
6870
'inspects_source': True, # Finds out what opponent will do
6971
'manipulates_source': False,
7072
'manipulates_state': False
@@ -81,6 +83,7 @@ class GellerDefector(Geller):
8183
'memory_depth': -1,
8284
'stochastic': False,
8385
'makes_use_of': set(),
86+
'long_run_time': False,
8487
'inspects_source': True, # Finds out what opponent will do
8588
'manipulates_source': False,
8689
'manipulates_state': False

axelrod/strategies/gobymajority.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class GoByMajority(Player):
2222
'stochastic': False,
2323
'inspects_source': False,
2424
'makes_use_of': set(),
25+
'long_run_time': False,
2526
'manipulates_source': False,
2627
'manipulates_state': False,
2728
'memory_depth': float('inf') # memory_depth may be altered by __init__

0 commit comments

Comments
 (0)