summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-12 10:23:57 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-12 10:28:11 +0100
commit7e23cb0e2a2ad82cddf354ee0d3c2773b99b4d02 (patch)
treea19f2bf0b136f758cf9484586c149fc8d3857c39 /rules
parentf71e8088890f18b4bf07015ba8b75100d35c2484 (diff)
downloadwbs-7e23cb0e2a2ad82cddf354ee0d3c2773b99b4d02.tar.gz
wbs-7e23cb0e2a2ad82cddf354ee0d3c2773b99b4d02.tar.bz2
wbs-7e23cb0e2a2ad82cddf354ee0d3c2773b99b4d02.zip
Prisoners Dilemma: Implement Gradual Killer
Diffstat (limited to 'rules')
-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]).