summaryrefslogtreecommitdiff
path: root/rules/gradual_killer.pl
diff options
context:
space:
mode:
Diffstat (limited to 'rules/gradual_killer.pl')
-rw-r--r--rules/gradual_killer.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/rules/gradual_killer.pl b/rules/gradual_killer.pl
new file mode 100644
index 0000000..599ef3e
--- /dev/null
+++ b/rules/gradual_killer.pl
@@ -0,0 +1,19 @@
+% Gradual Killer:
+% In the first five rounds it defects, than it cooperates in two rounds.
+% If the opponent has defected in rounds 6 and 7, than the Gradual Killer
+% keeps defecting forever, otherwise he keeps cooperation forever.
+
+gradual_killer(_, d, [], [1]).
+gradual_killer(_, d, [1], [2]).
+gradual_killer(_, d, [2], [3]).
+gradual_killer(_, d, [3], [4]).
+gradual_killer(_, d, [4], [5]).
+
+gradual_killer(_, c, [5], [6]).
+gradual_killer(_, c, [6], [7]).
+
+gradual_killer([d,d|_], d, [7], [d]):-!.
+gradual_killer(_, c, [7], [c]).
+
+gradual_killer(_, c, [c], [c]).
+gradual_killer(_, d, [d], [d]).