@@ -20,46 +20,44 @@ class LookerUp(Player):
20
20
* my last action was a C the opponents
21
21
* last action was a D
22
22
23
- then the corresponding key would be
23
+ then the corresponding key would be::
24
24
25
25
('C', 'C', 'D')
26
26
27
27
and the value would contain the action to play on this turn.
28
28
29
29
Some well-known strategies can be expressed as special cases; for example
30
- Cooperator is given by the dict:
30
+ Cooperator is given by the dict::
31
31
32
32
{('', '', '') : C}
33
33
34
- where m and n are both zero. Tit-For-Tat is given by:
34
+ where m and n are both zero. Tit-For-Tat is given by::
35
35
36
- {('', 'C', 'D'): D,
37
- ('', 'D', 'D'): D,
38
- ('', 'C', 'C'): C,
39
- ('', 'D', 'C'): C,
40
- }
36
+ {('', 'C', 'D'): D,
37
+ ('', 'D', 'D'): D,
38
+ ('', 'C', 'C'): C,
39
+ ('', 'D', 'C'): C}
41
40
42
41
where m=1 and n=0.
43
42
44
43
Lookup tables where the action depends on the opponent's first actions (as
45
44
opposed to most recent actions) will have a non-empty first string in the
46
- tuple. For example, this fragment of a dict:
45
+ tuple. For example, this fragment of a dict::
47
46
48
- {('C', 'C', 'C'): C,
49
- ('D', 'C', 'C'): D,
50
- }
47
+ {('C', 'C', 'C'): C,
48
+ ('D', 'C', 'C'): D}
51
49
52
50
states that if self and opponent both cooperated on the previous turn, we
53
51
should cooperate this turn unless the opponent started by defecting, in
54
52
which case we should defect.
55
53
56
54
To denote lookup tables where the action depends on sequences of actions
57
55
(so m or n are greater than 1), simply concatenate the strings together.
58
- Below is an incomplete example where m=3 and n=2.
56
+ Below is an incomplete example where m=3 and n=2::
57
+
58
+ {('CC', 'CDD', 'CCC'): C,
59
+ ('CD', 'CCD', 'CCC'): D}
59
60
60
- {('CC', 'CDD', 'CCC'): C,
61
- ('CD', 'CCD', 'CCC'): D,
62
- }
63
61
"""
64
62
65
63
name = 'LookerUp'
0 commit comments