forked from CoKn/axelrod-tournament
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjeremy_strategy.py
More file actions
36 lines (28 loc) · 940 Bytes
/
Copy pathjeremy_strategy.py
File metadata and controls
36 lines (28 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from axelrod.action import Action, actions_to_str
from axelrod.player import Player
from axelrod.strategy_transformers import (
FinalTransformer,
TrackHistoryTransformer,
)
C, D = Action.C, Action.D
class Jeremy(Player):
"""A player starts by cooperating and then defects only after two defects by
opponent.
Submitted to Axelrod's second tournament by John Maynard Smith; it came in
24th in that tournament.
Names:
- Tit for two Tats: [Axelrod1984]_
- Slow tit for two tats: Original name by Ranjini Das
- JMaynardSmith: [Axelrod1980b]_
"""
name = "Jeremy"
classifier = {
"memory_depth": 2,
"stochastic": False,
"long_run_time": False,
"inspects_source": False,
"manipulates_source": False,
"manipulates_state": False,
}
def strategy(self, opponent: Player) -> Action:
return D if D in opponent.history[-2:] else C